Skip to content

Python elif Statement with AND Operator | Example code

  • by

Let’ see how to use AND operator to combine two basic conditional expressions in the boolean expression of the Python elif condition statement.

Example elif Statement with AND Operator in Python

Simple python example code.

mark = 50

if mark < 40:
    print('Failed')

elif 40 < mark < 80 and mark < 90:
    print('A+')

elif 80 < mark < 101:
    print('A++')

Output:

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

Your email address will not be published. Required fields are marked *