How to remove duplicate elements from a list ,
Example :my_list =[2,5,7,9,10,4,2,9]
I want to display only the unique elements and not the recurring elements ..
Asked
Active
Viewed 150 times
0

user12019905
- 9
- 1
-
Use a set. `list(set(my_list))` – Lamanus Sep 04 '19 at 13:53
-
Thanks bro ✌ – user12019905 Sep 04 '19 at 13:56
-
1Possible duplicate of [Removing duplicates in lists](https://stackoverflow.com/questions/7961363/removing-duplicates-in-lists) – wjandrea Sep 04 '19 at 14:03
1 Answers
0
like this:
list1 = [2,5,7,9,10,4,2,9]
list2 = list(dict.fromkeys(list1))
print(list2)

Murilo Portugal
- 146
- 3