a = 200 b = 33 if b > a: print("b is greater than a") elif a == b: print("a and b are equal") else: print("a is greater than b")
Operator: and Syntax: x and y Description: True if both the operands are true # Examples of Logical Operator a = True b = False # Print a and b print(a and b) # False
if x==1 or y==1: print(x,y)
if num<5: print('Num less than 5') elif 5<= num <=9: print('Num between 5 and 9') else: print('Num more than 9')
x=1; y=0; z=0; if x==1 or y==0: if z=0 and x=1: print('Useless conditions satisfed!')
# Syntax for Boolean expression with or in Python exp1 or exp2
if (condition): result
#if you are doing this if X=1 #Do this if X==1