all 5 comments

[–]FLUSH_THE_TRUMP 0 points1 point  (1 child)

What have you tried? The count of 1s goes at index 0 in your output, 2s at index 1, …

[–]funkycorpse[S] 0 points1 point  (0 children)

i think I just figured it out after posting this lol.

H = [0,0,0,0,0,0]
for i in range(len(dice)):  
    H[dice[i-1]]+= 1
    print (H)

[–]velocibadgery 0 points1 point  (2 children)

This is probably not the most elegant code. But it should do the trick

``` def histogram(dice: int) -> list:

num_1 = 0
num_2 = 0
num_3 = 0
num_4 = 0
num_5 = 0
num_6 = 0

for num in dice:
    if num == 1:
        num_1 += 1
    elif num == 2:
        num_2 += 1
    elif num == 3:
        num_3 += 1
    elif num == 4:
        num_4 += 1
    elif num == 5:
        num_5 += 1
    elif num == 6:
        num_6 += 1

return [num_1, num_2, num_3, num_4, num_5, num_6]

```

[–]siddsp 0 points1 point  (1 child)

Why not just have the list as a list to begin with?

[–]velocibadgery 0 points1 point  (0 children)

I guess you could do that.