Skip to content

Python elif Statement with OR Operator in Condition/Expression – Example code

  • by

Python elif Statement with OR Operator using combines two basic conditional expressions in a Boolean expression.

Checking weekday and weekend string in if statement.

today = 'Sunday'

if today == 'Monday':
    print('Your weekend is over. Go to work.')
    
elif today == 'Sunday' or today == 'Saturday':
    print('Today is off.')
else:
    print('Go to work.')

Output:

Python elif Statement with OR Operator in Condition

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading