Program Console Vignaankosh.com
Execution Panel
Console is empty.
Slice a tuple 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.
# Slicing tuples (start:stop:step)
alpha = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h')
print("Original tuple:", alpha)
# Basic slices
print(f"alpha[2:6]: {alpha[2:6]}") # indices 2 to 5
print(f"alpha[:4]: {alpha[:4]}") # first 4 elements
print(f"alpha[5:]: {alpha[5:]}") # from index 5 to end
print(f"alpha[:]: {alpha[:]}") # whole tuple copy
# Step parameter
print(f"alpha[::2]: {alpha[::2]}") # every 2nd element
print(f"alpha[1::2]: {alpha[1::2]}") # every 2nd from index 1
print(f"alpha[::-1]: {alpha[::-1]}") # reverse tuple