← Back to Loops

Countdown Timer

2 of 6

Exercise 1: Countdown Timer

You're building a rocket launch countdown! Use a while loop to count down from a starting number to 1, then print "Liftoff!"

Expected output (start = 5):

5
4
3
2
1
Liftoff! πŸš€

Starter Code

count = 5 while count > ___: print(count) count -= ___ print("Liftoff! πŸš€")

Hints

Hint 1 β€” When should the loop stop?

The loop should keep running while count is greater than 0: while count > 0:

Hint 2 β€” How to count down?

Subtract 1 from count each time through the loop: count -= 1

Without this line, the loop would run forever!

Try it yourself

Code: Countdown Timer

Loading Python runtime…
Python …
Loading...
bash
$ Click "Run" to execute your code...