and or in python code example
Example 1: or statement python
if x==1 or y==1:
print(x,y)
Example 2: python or
x = 1
y = 10
if x%2 == 0 or y%2 == 0:
print(x%2)
#Output#
#1
Example 3: x and y in python
x = 10
y = 12
# Output: x > y is False
print('x > y is',x>y)
# Output: x < y is True
print('x < y is',x<y)
# Output: x == y is False
print('x == y is',x==y)
# Output: x != y is True
print('x != y is',x!=y)
# Output: x >= y is False
print('x >= y is',x>=y)
# Output: x <= y is True
print('x <= y is',x<=y)
Example 4: or in python
# Syntax for Boolean expression with or in Python
exp1 or exp2
Example 5: logical operators in python
condition1 and condition2
condition1 or condition2
not condition