0
Can someone please tell me why is there an error?
print("Please answer this survey") x = input(str("How are you feeling today?: ")) print(x) y = "Good", "Fine", "Happy", "Excited" z = "Bad", "Sad", "Not okay", "Not good" if x = y print("Good to know :)\)") if x = z print("Cheer up!! I'm always here for you :)\)")
2 Answers
+ 1
Once you turn <y> and <z> into a tuple or list, you can use `in` operator to check whether <x> exist in either tuple <y> or <z>. I would suggest to convert <x>, and also all values in <y> and <z> to lowercase, so that alphabet case wouldn't get in the way.
if x in y:
# <x> exists in <y>
elif x in z:
# <y> exists in <z>
(Edit)
You don't need `str` when reading input, just read input into <x>.
x = input("Hello, how are you doing today?")