Sunday, 8 September 2013

Python - How to know how many kinds of objects there are in a list

Python - How to know how many kinds of objects there are in a list

a = [1,1,2,2,2,3,3,3,4]
I want answer to be 4 since there are 4 types (1,2,3,4) Is there any
module to do this?
Thanks in advance

No comments:

Post a Comment