weather = input('How is the weather bro ')
if weather == 'summer' or 'hot':
print('OH! thats why i am sweating')
elif weather == 'winter' or 'cool':
print('I need a blanket.I am shivering like anything')
else:
print('lets hope that it gets better tomorrow')
:
i gave the input cool but it still gives output saying OH! thats why i am sweating
output I got
How is the weather bro cool
OH! thats why i am sweating
Process finished with exit code 0
Take a closer look at the conditions by if and elif. or is not used here the way you think.
For logical expression with or to be evaluated as True one of the sides must evaluate to True. Here’s weather == 'summer' on one side and 'hot' on the other. As the 'hot' is a non-empty string it considered as truthy value - it evaluates to True. So the way this condition is written, it always will be True.