Plenty of π
Module 3: Control Flow - Conditional Execution and Loops
Lab: Lab 3.1: Loop Master - Number Printer

Write a loop that prints numbers from 1 to 10 (inclusive). Inside the loop, add logic to skip printing the number 5 and to stop the loop entirely if the number 9 is reached (so 9 should not be printed).

Tasks to Complete:

  • Create a `for` loop that iterates from 1 to 10.
  • Inside the loop, use an `if` statement to check if the current number is 5. If it is, use `continue` to skip printing it.
  • Add another `if` statement to check if the current number is 9. If it is, use `break` to exit the loop.
  • Print the current number if it's not skipped or if the loop hasn't broken.

Python Sandbox

Python execution is powered by Pyodide, running directly in your browser. The `input()` function is not supported in this sandbox; please define variables directly in your code.