← Back to Algorithm Review

Remove Duplicates

2 of 4

Exercise 2: Remove Duplicates from a List

πŸ“‹ Lists πŸ”‚ Loops

Your Task

Write a program that removes duplicate values from a list while preserving the order of first occurrence.

Example: [3, 1, 4, 1, 5, 9, 2, 6, 5, 3] β†’ [3, 1, 4, 5, 9, 2, 6]


Example Output

Original: [3, 1, 4, 1, 5, 9, 2, 6, 5, 3]
No duplicates: [3, 1, 4, 5, 9, 2, 6]

Try it yourself

Code: Remove Duplicates

Loading Python runtime…
Python …
Loading...
bash
$ Click "Run" to execute your code...