samedi 6 octobre 2018

Python appending random int in range to list, count number of occurences of numbers

So I have the following code:

import random
from collections import Counter
L = []
for x in range(0, 100):
    L.append([])
    for y in range(0, 6):
        L[x].append(random.randint(0, 45) + 1)

Now I need to be able to count the number of times each number appears in the list. I tried counter and all kinds of other stuff, still get errors and I'm stuck. Any help would be appreciated.




Aucun commentaire:

Enregistrer un commentaire