Program Console Vignaankosh.com
Execution Panel
Console is empty.
Access tuple elements using index 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.
# Access tuple elements using positive indexing
colors = ("Red", "Green", "Blue", "Yellow", "Purple")
print("Tuple:", colors)
# Access by index
print(f"Index 0 (first): {colors[0]}")
print(f"Index 2 (third): {colors[2]}")
print(f"Index 4 (last): {colors[4]}")
# Access with variable
idx = 3
print(f"Index {idx}: {colors[idx]}")
# Trying to modify - will cause error
try:
colors[0] = "Orange"
except TypeError as e:
print(f"\nError: {e}")