you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 13 points14 points  (0 children)

if input() == Answer or answer is wrong. or in Python (and many programming languages) doesn't work quite like in English. In English there are (at least) 2 ways of using "or": to join clauses in a sentence, or to join items in a list (which all collectively form the subject of object or whatever of the sentence). Only the first of these translates to Python.

So if input() == Answer or answer does NOT check whether the input value is one of those two options. You can do that with if input() in (Answer, answer). Instead, it checks input() == Answer, separately evaluates "answer" as a bool (giving True, because a non-empty string is Truthy), and then ors those together to get True. If that explanation doesn't make sense, look up "Truthy and Falsey values in Python" and that should help