How to use if OR Statements in Python

Python if OR statements provide the same logic as multiple if-else statements but with the ability to execute the same block of code if one of the statements is True.

 

To create an OR statement in Python, place or between two different evaluations.

 

To demonstrate this, let's check if the current day is not the weekend using an OR statement and execute some code if True.

 

today = 'Thursday'

if today == 'Saturday' or today == 'Sunday':
   print(f'Today ({today}) is the weekend!')
else:
   print(f'Today ({today}) is a work day!')
Today (Thursday) is a work day!

Related Tutorials