Reverse a string using for loop Dry Run in PYTHON

Reverse a string using for loop 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.

Reverse a string using for loop Program Code

# Reverse a string using for loop
text = input("Enter a string: ")
reversed_text = ""

for char in text:
    reversed_text = char + reversed_text

print(f"Original: {text}")
print(f"Reversed: {reversed_text}")
print(f"Using slicing: {text[::-1]}")

View the complete For programs page.

Program Console Reverse a string using for loop Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.