The neighbourhood list of pets is a list of kinds like ["cat", "dog", "cat"]. Write count_pets(pets) to return a dict of how many of each kind, in the order they first appear. An empty list gives {}.
count_pets(["cat", "dog", "cat"])→{'cat': 2, 'dog': 1}count_pets(["fish", "fish", "fish"])→{'fish': 3}def count_pets(pets):
counts = {}
for pet in pets:
# your code here: 1 the first time, otherwise add 1
pass
return counts
Run tries the examples. When they look right, Submit.