+ 1
Why my Jungle Camping code is failed in 3rd test?? Plz help
noise=str(input()) noise1=noise.split() animals={'Lion':'Grr','Tiger':'Rawr','Snake':'Ssss','Birds':'Chirp'} m=[] for a in animals: for k in noise1: if animals[a]==k: m.append(a) else: continue j=' '.join(m) print(j)
4 Respuestas
+ 2
Almost... I was wrong suggesting, it would not allow repeating them, in fact in does, but you are rearranging them then! 😉
e.g. for [Lion: Gr, Bird: Chirp] you will output Lion Lion -> Gr Gr, but Lion Bird Lion -> Gr Gr Chirp.
+ 2
Sandra Meyer
Plz suggest me any changes in it..!!!
+ 1
I'm almost sure, it is your outer loop. Your code does not allow, that an animal is repeated after another one!
0
You don't need the outer loop at all! Iterate over the noises only, not over the animals. Replace each noise with an animal name...