Traverse tuple using for loop Dry Run in PYTHON

Traverse tuple using for loop is an interactive PYTHON dry run visualizer from the Tuples 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.

Traverse tuple using for loop Program Code

# Different ways to traverse a tuple
weekdays = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
print("Tuple:", weekdays)

print("\n1. Direct element access:")
for day in weekdays:
    print(f"  {day}")

print("\n2. Using index with range():")
for i in range(len(weekdays)):
    print(f"  Index {i}: {weekdays[i]}")

print("\n3. Using enumerate():")
for idx, day in enumerate(weekdays):
    print(f"  {idx} → {day}")

View the complete Tuples programs page.

Program Console Traverse tuple using for loop Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.