[Tutor] Breaking out of loop...

Ken G. beachkid at insightbb.com
Fri Nov 20 18:02:18 CET 2009


I am trying to break out of a loop posted below.  When asked for 
monthdate, it should break out if I entered the number zero and it does 
not.  GRRR.  Been working on this for almost an hour.

    monthdate = 999

    while monthdate <> 0:
        monthdate = raw_input('Enter the month and date in two digit 
format each: ')           
        month = monthdate[0:2]
        date = monthdate[2:4]
        year = ('2009')
        print month, date, year

    print "Finished!"

Thanking you all in advance for your help.

Ken

   


More information about the Tutor mailing list