# How conditions work
if condition:
# if condition met
# code here
elif condition2: # (else if) checked if the first condition is false
# if condition2 met
# code here
elif condition3: # elif can be chained
# if condition3 met
# code here
else:
# if none of the conditions are met
# code here
# example
if name == "bob": # ex. a == b (is a equal to b)
print("the wifi password is 1234")
elif name == "jake": # if the first condition is not met python checks this one
print("the secret formula is under the bed")
else: # if none of the conditions are met
print("sorry i don't know who you are")
# Other Example
if age >= 18:
print('You can go in')
else:
print('you cannot pass, you are underage')
ensoleille = False
neige = True
if ensoleille:
print("on va à la plage !")
elif neige:
print("on fait un bonhomme de neige")
else:
print("on reste à la maison !")
with_sun = True
in_week = False
if with_sun and not in_week:
print("we go to the beach !")
elif with_sun and in_week:
print("we go to work !")
else:
print("we stay at home !")
avec_soleil = True
en_semaine = False
if avec_soleil and not en_semaine:
print("on va à la plage !")
elif avec_soleil and en_semaine:
print("on va au travail !")
else:
print("on reste à la maison !")