近所のペットのリストは ["cat", "dog", "cat"] のように種類が並んでいます。count_pets(pets) を書いて、種類ごとの数を辞書で返しましょう。順番は最初に出てきた順です。空のリストなら {} です。
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:
# ここにコードを書く:初めてなら 1、そうでなければ 1 を足す
pass
return counts
実行すると例で試せます。よさそうなら提出しましょう。