Program Console Vignaankosh.com
Execution Panel
Console is empty.
Sort tuple elements 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.
# Sort tuple elements
unsorted = (64, 34, 25, 12, 22, 11, 90)
print("Original tuple:", unsorted)
# Method 1: sorted() returns list, then convert to tuple
sorted_tuple = tuple(sorted(unsorted))
print(f"Ascending: {sorted_tuple}")
# Method 2: Descending order
desc_tuple = tuple(sorted(unsorted, reverse=True))
print(f"Descending: {desc_tuple}")
# Sorting strings
fruits = ("banana", "apple", "cherry", "date")
sorted_fruits = tuple(sorted(fruits))
print(f"\nSorted strings: {sorted_fruits}")