L’animalerie compte ses animaux dans un dictionnaire comme {"cat": 3, "dog": 2}. Écris total_pets(pets) qui renvoie le nombre total d’animaux. Pour un dictionnaire vide, renvoie 0.
total_pets({"cat": 3, "dog": 2})→5total_pets({"rabbit": 4, "fish": 10, "bird": 1})→15def total_pets(pets):
total = 0
# ton code ici: additionne la quantité de chaque espèce
return total
Exécuter teste les exemples. Quand ils sont bons, appuie sur Envoyer.