the_list = [5, 7, 6, 5, 5, 4, 4, 7, 5, 4]
answer1 = [0] * 13
for i in the_list:
    answer1[i] += 1
answer1
for i, v in enumerate(answer1):
    if v:
        print(i, v)
answer2 = [(i, v) for i, v in enumerate(answer1) if v]
answer2
how to optimally count elements in a python list