← 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...
Output
Click "Run" to execute your code...
ℹ️ About this Python environment

βœ… Standard library: heapq, collections, itertools, math, random, functools, datetime, bisect

βœ… Functions, classes, recursion, print()

❌ No file system, subprocess, OS access, or network requests

❌ No pip install (all supported modules are pre-loaded)

⏱️ 5 second execution time limit