[Tutor] FW: Fwd: (no subject)

Amit Saha amitsaha.in at gmail.com
Sun Mar 31 04:43:04 CEST 2013


On Sun, Mar 31, 2013 at 12:39 PM, Soliman, Yasmin <ysoliman at uncc.edu> wrote:
> So if it should look like this, it gives error that says Quit is not defined, also why does it not recognize the sys import when I run it?
>
> import weekday_string1
> import sys
> while True:
>     ryear = raw_input("year= ")
>     print ryear
>
>     if ryear == 'Quit':
>         print '\nThank you for using this program! Bye.'
>         break

Okay, here is a small program:

while True:
    ryear = raw_input("year= ")
    print ryear

    if ryear == 'Quit':
        print '\nThank you for using this program! Bye.'
        break
    else:
        print 'Not quitting'

When I run this, I see:

year= 10
10
Not quitting
year= 10
10
Not quitting
year= 20
20
Not quitting
year= Quit
Quit

Thank you for using this program! Bye.

As you can see, when I enter "Quit", it exists. Can you try and see if
that works for you?

Best,
Amit.

--
http://amitsaha.github.com/


More information about the Tutor mailing list