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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly