Print all prime numbers between two numbers Dry Run in PYTHON

Print all prime numbers between two numbers 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 prime numbers between two numbers Program Code

# Print prime numbers in a range
start = int(input("Enter start: "))
end = int(input("Enter end: "))

print(f"Prime numbers between {start} and {end}:")

for num in range(start, end + 1):
    if num <= 1:
        continue
    
    is_prime = True
    for i in range(2, int(num ** 0.5) + 1):
        if num % i == 0:
            is_prime = False
            break
    
    if is_prime:
        print(num, end=" ")

print()

View the complete For programs page.

Program Console Print all prime numbers between two numbers Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.