code for if else 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: python if elif
num = 20
if num > 30:
print("big")
elif num == 30:
print("same")
else:
print("small")
#output: small