Asked about Lists, dictionaries and sets
How would you remove duplicates from a list?
An answer that works
list(set(items)) is the quickest way, but it loses the original order. If order matters, use list(dict.fromkeys(items)), because dictionaries keep insertion order in modern Python.
Reading an answer is not being able to give one. The section that teaches this is Lists, dictionaries and sets, 3 hours of Python.
Learn this properlyAlso asked about Python
What is the difference between a list and a tuple?Why use join instead of adding strings in a loop?What is the difference between == and is?What does s[::-1] do?Why is checking membership in a set faster than in a list?What happens if you use a list as a dictionary key?What is the difference between sorted(x) and x.sort()?What is wrong with def f(items=[])?
All 36 questions on Python