Sep-19-2019, 03:22 PM
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()
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()