- 720p
- 540p
- 360p
- 0.50x
- 0.75x
- 1.00x
- 1.25x
- 1.50x
- 1.75x
- 2.00x
We hope you enjoyed this lesson.
Cool lesson, huh? Share it with your friends
About this lesson
Exercise files
Download this lesson’s related exercise files.
Conditionals If/Else/Elif59.1 KB Conditionals If/Else/Elif - Solution
59 KB
Quick reference
Conditionals If/Else/Elif
Conditional statements allow us to compare things and make decisions based on those comparisons.
When to use
Anytime you need to make a decision, and take actions based on those decisions, you'll use conditional statements.
Instructions
The main conditional statements are If, If/Else, and If/Elif statements.
If statement:
if (3 < 5):
print("3 is less than 5")
If/Else statement:
if (3 < 5):
print("3 is less than 5")
else:
print("3 is not less than 5")
If/Elif statement:
if (3 < 5):
print("3 is less than 5")
elif (3 == 3):
print("3 is equal to 3")
else:
print("3 is not less than 5")
Hints & tips
- Conditional statements let you make decisions and take actions based on those decisions
- if, if/else, and if/elif
- Tab spacing/indenting is important!!
Lesson notes are only available for subscribers.