Program Console Vignaankosh.com
Execution Panel
Console is empty.
Remove duplicates from list using set is an interactive PYTHON dry run visualizer from the Sets 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 list using set
numbers = [1, 2, 2, 3, 4, 4, 4, 5, 6, 6, 7, 7, 7, 8]
print("Original list:", numbers)
print(f"Original length: {len(numbers)}")
# Method 1: Convert to set then back to list (order NOT preserved)
unique_set = set(numbers)
unique_list1 = list(unique_set)
print("\nMethod 1 (set):", unique_list1)
print(f"Unique length: {len(unique_list1)}")
# Method 2: Preserve order using dict.fromkeys()
unique_ordered = list(dict.fromkeys(numbers))
print("\nMethod 2 (preserve order):", unique_ordered)
# Method 3: Manual loop (preserve order)
unique_manual = []
for num in numbers:
if num not in unique_manual:
unique_manual.append(num)
print(f"Method 3 (manual): {unique_manual}")