Example code How to use AND operator to combine two basic conditional expressions in the boolean expression of the Python If-Else condition statement.
if a == 1 and b > 0:
Example If-Else Statement with AND Operator in Python
Simple python example code.
a = 1
b = 10
if a == 1 and b > 0:
print('a is 1 and', b, 'is greater than zero.')
else:
print('a is not 1 or', b, 'is not greater than zero.')
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.