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)
student_grades = [9.1, 8.8, 10.0, 7.7, 6.8, 8.0, 10.0, 8.1, 10.0, 9.9]
samebnumber = student_grades.count(10.0)
print(samebnumber)
# list of cars
cars = ['Benz','BMW','Ford','Ferrari','volkswagen','BMW']
numbers= [1,5,2,5,7,1,3,3,1,6]
# BWM Count in list
bmwCount = cars.count('BMW')
print("total no BMW count is = ",bmwCount)
# number count in list
numCount = numbers.count(1)
print("The count of number 1 is = ",numCount)
# if you give number in string format
numCount = numbers.count('3')
print("The count of number 3 is= ",numCount)
list_number = [6, 3, 8, 0]
length = len(list_number)
#output 4
colors = ['red', 'green', 'blue', 'orange','blue']
color_count = colors.count('blue')
print('The count of color: blue is ', color_count)
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)