0

I can't seem to figure out what's wrong with this simple code. I have a user input and if it matches prints out 'That's good', if not prints out 'Too bad' but how can I get the input to ignore being case sensitive?

ans=raw_input("Are you feeling well today? ")
if ans == "yes":
    print "That's good"
else:
    print "Too bad"

I want it so if someone enters "YES" it will still print "That's good"

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by kiddo39
0

"YES" is not the same as "yes".

To rectify, convert the input to lower case. Something like:

ans=raw_input("Are you feeling well today? ")
if ans.lower() == "yes":
    print "That's good"
else:
    print "Too bad"
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.