Program Console Vignaankosh.com
Execution Panel
Console is empty.
Remove duplicate elements from 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.
# Remove duplicates from tuple
nums = (5, 8, 8, 12, 15, 15, 15, 20, 24, 24, 30)
print("Original:", nums)
# Method 1: Using set (order not preserved)
unique_set = tuple(set(nums))
print(f"Using set: {unique_set}")
# Method 2: Using dict.fromkeys() (preserves order)
unique_ordered = tuple(dict.fromkeys(nums))
print(f"Preserving order: {unique_ordered}")
# Method 3: Manual loop
seen = set()
manual_unique = []
for num in nums:
if num not in seen:
seen.add(num)
manual_unique.append(num)
print(f"Manual: {tuple(manual_unique)}")