where condition in python code example
Example 1: if syntax in python
variable_name = input("y/n? >> ")
if variable_name == "y":
print("That's good! :) ")
elif variable_name == "n":
print("That's bad! :( ")
else:
print("You blow up for not following my instructions. Detention forever and get lost!")
Example 2: if statement python
x=5
if x == 5:
print("x is 5")
else:
print("x is not 5")
Example 3: python condition
if condition:
elif condition:
else:
hour = 14
if hour < 8:
print("It's morning")
elif hour < 18:
print("It's the day")
else:
print("It's the evening")