Track 3 · Lesson 2 of 11
Two-way decisions with else
Choose between exactly two paths with if and else, so that one of them always runs.
You will be able to
- Write an if-else statement where exactly one of two blocks runs
- Assign a variable in both branches so it always exists afterwards
- Decide which branch a threshold value belongs to
- Spot code that sits outside the else block by mistake
Included with a Formula Quest membership
It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.