Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def singers ():
- print 'This program rates singers.'
- excellentList = ['River Cuomo', 'Billy Joel', 'Bruce Springsteen', 'David Bowie'];
- goodList = ['Corey Taylor', 'Katy Perry'];
- sosoList = ['Drake'];
- singersList = excellentList + goodList + sosoList;
- print 'List of all Singers: ', singersList;
- while (True):
- singer = raw_input('Enter singer name (unquoted): ');
- if (singer in excellentList): rating = Excellent;
- elif (singer in goodList): rating = Good;
- elif (singer in sosoList): rating = So-so;
- else: rating = unknown;
- print 'Singer', singer, 'Rating:', rating;
- ans = inputYesNo('Process more? [Yes/No]: ');
- if (ans == 'No'): break;
- print 'So long...';
- # Input valid answer for a Yes/No question:
- def inputYesNo(prompt):
- response = raw_input(prompt);
- while (response != 'Yes' and response != 'No'):
- print 'Invalid response: ', response;
- response = raw_input(prompt);
- return response;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement