Pythondex

Exercise

While Loop Exercise

In this exercise, you’ll practice using a while loop to repeat a task multiple times.

Task

Write a Python program that:

  • Starts a counter at 1
  • Prints the counter value each time through the loop
  • Stops when the counter reaches 10
  • Adds 1 to the counter after each iteration

Example Output

Solve