Iteration: While Loops
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...
- For help with iteration, visit this page.
- Use a while loop to keep subtracting 1 from the number until it reaches zero.
- Print each number as you go.