Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: Implement a function to remove duplicates from a list.
Answer:

def remove_duplicates(lst):

  return list(set(lst))

Example:

remove_duplicates([1, 2, 2, 3, 4, 4, 5])  # Output: [1, 2, 3, 4, 5]
Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook