How can I remove duplicates in array for Python?

0 votes

1 Answer

0 votes
No avatar answered by (18.7k points)
selected by
 
Best answer

my_list = [1,2,3,4,3,2,1]
my_set = set(my_list)

print(my_set)
# Output: {1, 2, 3, 4}

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register
...