Worksheet 4 - Nested If
- Worksheet 3 - Branching
-
Worksheet 4 - Nested If
- Teamwork 2 - Odd Numbers
- ZB3: Branching
Print out the worksheet
Download worksheet and follow along. Stop and do each exercise as it comes up between the videos.
This worksheet refers to a teamwork project, TW2: Odd Numbers, that you should be working on with your blue team about now.
An if-clause or an else-clause can contain if-then-else statements. These are called nested ifs.
If the only thing comprising an else-clause is a another if-then-else, then we can shorten the Python code with the keyword elif.
You can check your work with the worksheet solutions
Download solutions.