+ 1

Hi guys, i tried to do the jungle camping challenge. But i keep failing the third test case. My code is in the description.

jungle_sound = input() animal = "" grr = jungle_sound.count("Grr") rawr = jungle_sound.count("Rawr") ssss = jungle_sound.count("Ssss") chirp = jungle_sound.count("Chirp") if "Grr" in jungle_sound: animal += "Lion " * grr if "Rawr" in jungle_sound: animal += "Tiger " * rawr if "Ssss" in jungle_sound: animal += "Snake " * ssss if "Chirp" in jungle_sound: animal += "Bird " * chirp print (animal)

17th Apr 2020, 5:53 PM
Olufemi Tofunmi
Olufemi Tofunmi - avatar
1 Resposta
+ 1
Maybe your problem is that you have a space at the end. Input: Grr Output: Lion len(animal) gives 5
17th Apr 2020, 7:13 PM
Denise Roßberg
Denise Roßberg - avatar