Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. def singers ():
  2. print 'This program rates singers.'
  3. excellentList = ['River Cuomo', 'Billy Joel', 'Bruce Springsteen', 'David Bowie'];
  4. goodList = ['Corey Taylor', 'Katy Perry'];
  5. sosoList = ['Drake'];
  6. singersList = excellentList + goodList + sosoList;
  7. print 'List of all Singers: ', singersList;
  8.  
  9. while (True):
  10. singer = raw_input('Enter singer name (unquoted): ');
  11. if (singer in excellentList): rating = Excellent;
  12. elif (singer in goodList): rating = Good;
  13. elif (singer in sosoList): rating = So-so;
  14. else: rating = unknown;
  15. print 'Singer', singer, 'Rating:', rating;
  16. ans = inputYesNo('Process more? [Yes/No]: ');
  17. if (ans == 'No'): break;
  18. print 'So long...';
  19.  
  20. # Input valid answer for a Yes/No question:
  21. def inputYesNo(prompt):
  22. response = raw_input(prompt);
  23. while (response != 'Yes' and response != 'No'):
  24. print 'Invalid response: ', response;
  25. response = raw_input(prompt);
  26. return response;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement