[Tutor] Engarde program was: i++

scott slewin at rogers.com
Wed Jun 6 23:08:04 CEST 2007


Alan Gauld wrote:
> You never change i so this is always true.
> Therefore you can express that better with...
Thanks for your suggestions, I put together the following based on them:
##############################################
def is_yes(question):
     while True:
         s = raw_input(question).lower()
         if s == 'y' or s == 'yes':
             return True
         elif s == 'n' or s == 'no':
             return False
         else:
             print '\nplease select y, n, yes, or no\n'
################################################

It seems to work perfectly :)

-- 
Your friend,
Scott

Sent to you from a Linux computer using Kubuntu Version 7.04 (Feisty Fawn)


More information about the Tutor mailing list