Program Console Vignaankosh.com
Execution Panel
Console is empty.
Find duplicate elements in list is an interactive PYTHON dry run visualizer from the Lists 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.
# Find duplicate elements
data = [1, 2, 3, 2, 4, 5, 3, 6, 7, 1, 8, 2]
print("List:", data)
# Method 1: Using dictionary
seen = {}
duplicates = []
for item in data:
if item in seen:
if seen[item] == 1:
duplicates.append(item)
seen[item] += 1
else:
seen[item] = 1
print(f"Duplicate elements: {duplicates}")
# Method 2: Using set (simpler)
seen_set = set()
dups = set()
for item in data:
if item in seen_set:
dups.add(item)
else:
seen_set.add(item)
print(f"Duplicates using set: {list(dups)}")