Q:

Write a Python function that takes a list and returns a new list with unique elements of the first list

0

Write a Python function that takes a list and returns a new list with unique elements of the first list

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

I have used python 3.7 compiler for debugging purpose.

def unique_list(l):
  num = []
  for a in l:
    if a not in num:
      num.append(a)
  return num
print('unique elements are')
print(unique_list([1,2,4,5,4,5,6,9,10]))

Result:

unique elements are

[1, 2, 4, 5, 6, 9, 10]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a Python function that takes a number as a p... >>
<< Write a Python function that accepts a string and ...