livepython.net

93. Fix the Endless Countdown Loop

EasyEndless loops

Overview

This countdown is an infinite loop: it prints 5 again and again, and never reaches Liftoff!. Find the missing line and add it.

Problem Statement

The starter code should count down from 5 to 1 and then print Liftoff!. Instead, it never stops: the editor stops it for you. Fix the code so it prints exactly:

5
4
3
2
1
Liftoff!

Ask the two questions from the lesson: which variable does the condition check, and does a line inside the loop change it?

Input

No input is required for this question.

Output

5
4
3
2
1
Liftoff!

Learn this firstChapter 11 · Infinite Loops in Python and How to Avoid Them
solution.py
n = 5
while n > 0:
    print(n)
print("Liftoff!")

EXPECTED OUTPUT

15
24
33
42
51
6Liftoff!

YOUR OUTPUT

Press Run to see your output here. Lines are compared with the expected output.