[Tutor] I'm puzzled

Vincent Zee zenzee at xs4all.nl
Mon Jan 23 00:46:26 CET 2006


Hi all,

I'm puzzled (:-))

Why will this little program crash when you enter the
enter key?

while True:
    a = raw_input('number? ')
    if a.isdigit():
        print 'isdigit'
    elif a[0] == '-' and a[1:].isdigit():
        print '- + isdigit'
    elif a == 'q':
        break
    else:
        print 'no digit'

/\
Vincent


More information about the Tutor mailing list