I got this piece of code from a friend of mine and I was very confused. Is there any logic behind this or just python weirdness?
He asked: What do you think will be the output if the user enters "yes" in question?
question = input("This is just a question. Enter anything\n")
print("First answer") if "yes" or "no" in question else print("you dumb")
I obviously answered, it will print "First answer" on "yes" & "no".
Then he asked:
and if the user enters "lol"? what then?
I said "you dumb".
Then he said "it gave me 'first answer'".
Now, what do you think?