Okay, so maybe this topic has already been answered in another Stock Exchange topic directly or indirectly, but I couldn't find one, so if you do find an appropriate post with answer that you think works, please link me too that post.
Below is my code:
while True:
example=input('Enter something')
if example=='Hi' or 'Bye':
print('Yay!')
else:
print('Something else.')
When example
does not result in the if
statement resulting in True
, (if
I don't enter 'Hi' or
'Bye' into example
), it fails to print
the else
statement and it instead, it will print
the return greeting in my if
statement. Why is this? Is this called short circuiting? And most importantly, how do I fix this? I'd like to know this because otherwise I would have to make a separate elif
statement, which takes a lot more code.
Please try to explain your answers in using basic terminology. By the way, I'm using Python 3.4.3.