for if in python code example
Example 1: python if statement
usrinput = input(">> ")
if usrinput == "Hello":
print("Hi")
elif usrinput == "Bye":
print("Bye")
else:
print("Okay...?")
Example 2: else if python
if expression1:
statement(s)
elif expression2:
statement(s)
elif expression3:
statement(s)
else:
statement(s)
Example 3: 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")