Print String Character by Character Dry Run in PYTHON

Print String Character by Character is an interactive PYTHON dry run visualizer from the Strings 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 String Character by Character Program Code

# Python program to print string character by character
text = "Python"

# Method 1: Using for loop
print("Method 1 (for loop):", end=" ")
for char in text:
    print(char, end=" ")

# Method 2: Using while loop with index
print("\nMethod 2 (while loop):", end=" ")
i = 0
while i < len(text):
    print(text[i], end=" ")
    i = i + 1

# Method 3: Using enumerate to get index and character
print("\nMethod 3 (enumerate):", end=" ")
for index, char in enumerate(text):
    print(char, end=" ")

print()  # New line

View the complete Strings programs page.

Program Console Print String Character by Character Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.