Conditionals Flashcards
1
Q
If
Else
A
If: Basic Syntax to test if a condition is true. If so, the indented code will be executed.
Else: A way to specify some code that will be execut e if a condition is false.
2
Q
Elif
A
You can add extra conditions. Once an elif condition is true, the rest of the elif conditions are no longer checked and are skipped.
if weather == “sunny”:
print(“bring sunglasses”)
elif weather == “rainy”
print(“bring umbrella”)