Python Programming - Lists - Discussion

Discussion Forum : Lists - General Questions (Q.No. 35)
35.
How can you create a new list containing only the unique elements from an existing list in Python?
new_list = list.unique()
new_list = list.distinct()
new_list = list(set(list))
new_list = list.remove_duplicates()
Answer: Option
Explanation:
Using set() to remove duplicates and then converting it back to a list creates a new list with unique elements.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.