Neewbie here. I'm doing CS50p and found myself confused about one of first problem sets.
In deep.py, implement a program that prompts the user for the answer to the Great Question of Life, the Universe and Everything, outputting Yes if the user inputs 42 or (case-insensitively) forty-two or forty two. Otherwise output No.
So I made this:
answ = input("What is Answer to the Great Question of Life, the Universe and Everything? ")
if answ == "42" or "forty two" or "forty-two":
print("Yes")
else:
print("No")
But output is always "yes".
However if I slice it like that:
answ = input("What is Answer to the Great Question of Life, the Universe and Everything? ")
if answ == "42":
print("Yes")
elif answ == "forty-two":
print("Yes")
elif answ == "forty two":
print("Yes")
else:
print("No")
It works.
Much thanks for simple answere.