Exercise
Loops Exercise: Print Even Numbers
In this exercise, you’ll practice using loops to print numbers and apply a condition to select only even numbers.
Task
Write a Python program that:
- Prints all even numbers from 1 to 50
- Uses a
forloop and anifstatement - Prints each number on a new line
- Use % (modulus) operator to check if a number is even
Example Output