CodeTestValidate

No installations needed! Write Python directly in your browser and get instant feedback with our smart validation system.

Challenge # 5

Remove Duplicates from a List

Objective

Remove all duplicate values from a list, keeping only the first occurrence of each value.

Instructions

  • You are given a list of integers called numbers.

  • Remove any duplicate values in the list.

  • Keep only the first occurrence of each number.

  • Print the resulting list.

Constraints:
Do not use input(). • The list contains only integers. • Preserve the original order of first appearances.
Exemple IO

Input: numbers = [1, 2, 2, 3, 4, 4, 4, 5]

Output: [1, 2, 3, 4, 5]

Input: numbers = [5, 5, 5, 5]

Output: [5]

Input: numbers = []

Output: []

Try It Online!

Output:

Validate Your Results

Get your code reviewed and validated to understand what you did right and where you can improve.

Previous challengeSum of All Numbers in a ListNext challengeCount Character Occurrences
Loading...