0

i put this code

name = raw_input ('please enter your name-->')
print 'hello ' + name
age = raw_input ('enter you age-->')
if age < 5:
    print 'what the...how did you understand on me'
elif age < 18:
    school = raw_input ('in wich school you are')
    print "I don't care"
else:
    ageelse = raw_input ('did you work(y-n)')
    if ageelse == ('y' or 'Y' or 'yes' or 'Yes'):
        work = raw_input ('what you work??')
        print "i don't care"
    elif ageelse == ('n' or 'N' or 'No' or 'no'):
        print "okkkaaaaaaaaaay.... and i don't care"
    else:
        print 'this is not a a right answer'

but he always give me the fist else and what i put in it

2
Contributors
1
Reply
23
Views
3 Weeks
Discussion Span
Last Post by Gribouillis
2

It is because after age = raw_input('...'), age is a character string. It needs to be converted to an integer like this

age = raw_input ('enter you age-->')
age = int(age)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.