+3 votes
in Programming Languages by (73.8k points)
I want to find the number of unique elements in a list. What function should I use for it?

1 Answer

+1 vote
by (348k points)
selected by
 
Best answer

You can use the unique() function of Numpy to check the unique elements in a list.

>>> s=[1,0,1,2,0,1,1,0,2,2,3,0]
>>> np.unique(s)
array([0, 1, 2, 3])


...