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

Print all odd 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 odd numbers from 1 to 20 Program Code

# Print odd numbers from 1 to 20
print("Odd numbers from 1 to 20:")

# Method 1: Using if condition
for i in range(1, 21):
    if i % 2 != 0:
        print(i, end=" ")

print("\n")

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

View the complete For programs page.

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