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

Jungle Camping Challenge problem

Hi, I am a beginner. I can’t seem to get the Jungle Camping challenge. Here’s my code, please help: animal = input() p = animal.count("Grr") i = animal.count("Rawr") t = animal.count("Ssss") y = animal.count("Chirp") Lions = "Grr" Tigers = "Rawr" Snakes = "Ssss" Birds = "Chirp" if animal >= Lions: print("Lion " * p) if animal >= Tigers: print("Tiger " * i) if animal >= Snakes: print("Snake " * t) if animal >= Birds: print("Bird " * y)

2nd Apr 2020, 10:21 AM
Sy Chew
Sy Chew - avatar
3 Answers
+ 2
Thanks a lot, PythonPip!
2nd Apr 2020, 11:48 AM
Sy Chew
Sy Chew - avatar
+ 1
Get an idea from this x=input() x=x.split() dict={"Rawr":"Tiger","Ssss":"Snake","Chirp":"Bird","Grr":"Lion"} k="" for i in x: k=k+i+" " try: k=k.replace(i,dict[i]) except: continue print(k)
2nd Apr 2020, 10:25 AM
Tricker
+ 1
def func(o): if o=='Ssss': print('Snake',end=' ') elif o=='Chirp': print('Bird',end=' ') elif o=='Rawr': print("Tiger",end=" ") elif o=='Grr': print('Lion',end=' ') n=list(map(str,input().split(" "))) for i in n: func(i)
2nd Apr 2020, 8:13 PM
Azi 🇺🇿