количество вхождений всех элементов в списке Python
import collections
a_list = ["a", "b", "a"]
occurrences = collections.Counter(a_list)
print(occurrences)
Important Ibex
import collections
a_list = ["a", "b", "a"]
occurrences = collections.Counter(a_list)
print(occurrences)
indices = [i for i, x in enumerate(my_list) if x == "whatever"]
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)
indices = [index for index, element in enumerate(a_list) if element == 1]
indices = list(filter(lambda x: x == 'whatever', my_list))