Jungle camping | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Jungle camping

It’s supposed to replace the sounds with animals, but it doesn’t do anything. word=input() while 'Rawr' in word: word.replace('Rawr','Tiger') while 'Chirp' in word: word.replace('Chirp','Bird') while 'Ssss' in word: word.replace('Ssss','Snake') while 'Grr' in word: word.replace('Grr','Lion') print(word)

22nd Sep 2023, 8:31 PM
Annihilate
Annihilate - avatar
2 Answers
+ 1
I solved this challenge in a different way. I use a for loop and append animals to a list that I turned into a string. https://code.sololearn.com/cQdPgZm0aiYc/?ref=app
22nd Sep 2023, 9:41 PM
Omar Fahmy
Omar Fahmy - avatar
+ 2
I would say replace while with if but I didn't testet it. Edit: Ah I just saw that you forget to set your world variable every time. word = word.replace...
22nd Sep 2023, 8:36 PM
Stefanoo
Stefanoo - avatar