Comment trouver aucun des fois des éléments dans la liste Python
thislist = (1, 3, 7, 8, 7, 5, 4, 6, 8, 5)
x = thislist.count(5)
print(x)
Bst Barracuda
thislist = (1, 3, 7, 8, 7, 5, 4, 6, 8, 5)
x = thislist.count(5)
print(x)
>>> from collections import Counter
>>> mylist = ["Bob", "Mike", "Bob", "Mike", "Mike", "Mike", "Bob"]
>>> Counter(mylist)
Counter({'Mike': 4, 'Bob': 3})
list.count(element)
list1 = ['red', 'green', 'blue', 'orange', 'green', 'gray', 'green']
color_count = list1.count('green')
print('The count of color: green is ', color_count)
from collections import Counter
a = [1,2,3,4,5,6,6,6,5,5]
Counter(a)
mylist = ["abc", "def", "ghi", "jkl", "mno", "pqr"]
print(len(mylist))
# output 6
a = ["more", 4, 6]
print(len(a))
# prints 3