Problem 101548 · easy · Phase 01 Prerequisites & Setup

Dice Tally

lists · counting · indexing

You rolled a six-sided die many times and recorded the results. Write dice_tally(rolls) that returns a list of six counts: how many times each face 1, 2, 3, 4, 5, 6 appeared, in that order.

Examples

Input:  rolls = [1, 6, 6, 3]
Output: [1, 0, 1, 0, 0, 2]

Input:  rolls = []
Output: [0, 0, 0, 0, 0, 0]

Constraints

  • 0 <= len(rolls) <= 5000
  • every roll is an integer from 1 to 6

Goals

  • Count occurrences of each possible value
  • Use a value as an index into a counts list
Starting Python…