Iteration: While Loops


Easy Challenge: Countdown Timer

Try it yourself!


  • Write a Python program that asks the user to input a starting number and then counts down to zero, printing each number.

Example Output:

> Enter a starting number: 5

5
4
3
2
1
0

Loading Python runtime...
  • Use a while loop to keep subtracting 1 from the number until it reaches zero.
  • Print each number as you go.