Skip to content

Get unique elements from a list in Python

def removeDuplicates(li):
  return list(set(li))
print(removeDuplicates([1, 2, 2, 1, 2, 3, 4, 3])) 
# [1, 2, 3, 4]

See also  How to get current location latitude and longitude in PHP?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.