Python Forum

Full Version: If Else Statement with User Input
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello all.

I have an assignment in Python where I need to ask the user whether they are happy or unhappy. The program will then draw a smiley face or a frowny face depending on the user's answer. I can easily use If else statements when the user's input is an integer, but I don't know how to do it if the user's answer is a word like Happy/Unhappy. Here's my code for the if else statement part (I know this is python 3. something, either 3.6 or 3.7):

question = input("Are you feeling happy or unhappy?: ")

if question == happy:
smiley_face()
else:
frowny_face()
try

if question == "happy":