tally_votes(ballots) that takes a list of candidate-name strings and returns a collections.defaultdict(int) mapping each candidate to how many votes (occurrences) they received.tally_votes(['A', 'B', 'A', 'C', 'B', 'A'])
{'A': 3, 'B': 2, 'C': 1}Count each candidate name.
`from collections import defaultdict`; `tally = defaultdict(int)`; then `tally[name] += 1` for each ballot.