Print all even numbers from 1 to 20 Dry Run in PYTHON

Print all even numbers from 1 to 20 is an interactive PYTHON dry run visualizer from the For programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.

This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.

Print all even numbers from 1 to 20 Program Code

# Method 1: Using if condition
print("Even numbers from 1 to 20:")
for i in range(1, 21):
    if i % 2 == 0:
        print(i, end=" ")

# Method 2: Using step parameter
print("\n\nUsing step parameter:")
for i in range(2, 21, 2):
    print(i, end=" ")
print()

View the complete For programs page.

Program Console Print all even numbers from 1 to 20 Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.