or in python if statement code example

Example 1: or statement python

if x==1 or y==1:
  print(x,y)

Example 2: python if and

if foo == 'abc' and bar == 'bac' or zoo == '123':
  # do something

Example 3: if statement in python

answer = input(":")
if answer == "lol":
  print("haha")
else:
  print("not haha")
  exit()

please note that the exit() command is optional and is not necessary.

Example 4: python if condition

if my_condition:
  # Do some stuff
  print("Hello You!")
else:
  # Do some stuff
  print("Hello World!")

Example 5: or in if statement python

weather == "Good!" or weather == "Great!": 

# Or the following  

weather in ("Good!", "Great!"):

Example 6: conditional block python

a = 1
b = 2
if a < b:
  print("a is less than b") #This will run since 1 is less than 2
elif a > b:
  print("a is greater than b")
else:
  print("a is equal to b")