← Quiz: Tuples and Sets: all 15 questions
Quiz: Tuples and Sets · Question 12 of 15
What is the easiest way to remove duplicates from a list names when order does not matter?
What is the easiest way to remove duplicates from a list names when order does not matter?
- A.names.unique()
- B.names.remove_duplicates()
- C.list(set(names))
- D.tuple(names)
Answer & explanation
Correct answer: list(set(names))
A set keeps only one copy of each value; convert back to a list if you need one.
Can you get the rest right without peeking?
Take the timed Quiz: Tuples and Sets quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →