Question: def count_items(items): Using the function provided. Below is the docstring as to what should result in the output. Take in a list of items and
def count_items(items):
Using the function provided. Below is the docstring as to what should result in the output.
"""Take in a list of items and return a dictionary with each item and the number of times it appears in the list.
>>> items = ['a', 'b', 'a', 'c', 'd', 'e', 'a', 'e'] >>> item_counts = count_items(items)
>>> sorted(item_counts.items()) [('a', 3), ('b', 1), ('c', 1), ('d', 1), ('e', 2)] """
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
