+ 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)
1 Antwort
+ 1
Maybe your problem is that you have a space at the end.
Input: Grr
Output: Lion
len(animal) gives 5