Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

nb_occurence in list python

>>> import random
>>> l = [random.randint(0,5) for i in range(10)]
>>> l
[1, 3, 0, 0, 5, 1, 0, 0, 0, 4]
>>> l.count(1)
2
>>> l.count(0)
5
>>> l.count(6)
0
Source by www.science-emergence.com #
 
PREVIOUS NEXT
Tagged: #list #python
ADD COMMENT
Topic
Name
5+2 =