L’hôtel pour animaux tient à jour rooms : le numéro de chambre de chaque animal. Écris IsStaying(rooms, pet) pour renvoyer true si l’animal y séjourne, et false sinon. La chambre 0 est une vraie chambre, elle aussi.
IsStaying(map[string]int{"Mochi": 3, "Bean": 5}, "Bean")→TrueIsStaying(map[string]int{"Mochi": 3}, "Rex")→Falsefunc IsStaying(rooms map[string]int, pet string) boolpackage main
func IsStaying(rooms map[string]int, pet string) bool {
// ton code ici: cherche pet dans rooms; renvoie true s'il y est
return false
}
Exécuter teste les exemples. Quand ils sont bons, appuie sur Envoyer.