python 2.7 - If statements and strings -
how can code respond string inputs? want if answer yes or no. tried this.
yes = 'yes' yesorno = input('yes or no?') if yesorno == yes: print'you said yes'
no matter typed input, say,'you said yes'.
in python 2 input
doesn't return string, object. want
choice = raw_input('yes or no?\n') if choice == 'yes': print 'you said yes' else: print 'you said no'
raw_input
return string.
Comments
Post a Comment