To find the cumulative count for a list of elements in another list , I can loop through the list for each element of the sublist (via list.count) and sum them up. Is it possible to the same with a more efficient Pythonic way?
Example:
test_list = [1,1,2,2,2,3,3,3,4,5,5,5]
to_be_counted = [1,2]
result = 5 (1 two times, 2 three times)