30 seconds of python

  Back to Home

unique_elements

listbeginner

Returns the unique elements in a given list.

Create a set from the list to discard duplicated values, then return a list from it.

def unique_elements(li):
  return list(set(li))