Program Console Vignaankosh.com
Execution Panel
Console is empty.
Reverse a list (multiple methods) is an interactive PYTHON dry run visualizer from the Lists 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 list - different techniques
original = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print("Original:", original)
# Method 1: Slicing (creates new list)
rev1 = original[::-1]
print("Method 1 (slicing):", rev1)
# Method 2: reverse() method (modifies original)
original.reverse()
print("Method 2 (reverse()):", original)
# Method 3: reversed() function
original2 = [10, 20, 30, 40, 50]
rev2 = list(reversed(original2))
print("\nMethod 3 (reversed()):", rev2)
# Method 4: Manual loop
manual_rev = []
for i in range(len(original2)-1, -1, -1):
manual_rev.append(original2[i])
print("Method 4 (manual loop):", manual_rev)