0

What is wrong with this code? Can someone help me. I was solving the sololearn community task and it seemed not to work.

animal = {"Lion":"Grr","Tiger":"Rawr","Snake":"Ssss","Chirp":" Bird"} sound = input() test = sound.split(' ') for s in test: for k, v in animal.items(): if s == v: print(k," ",end ="")

30th Mar 2021, 12:49 PM
AckĂžh Bwoy
AckĂžh Bwoy - avatar
2 RĂ©ponses
+ 4
You use animal as the key and their sounds as the value, except the bird which you did it oppositely. Also, there will be 2 spaces between each animal, whereas the desired is one.
30th Mar 2021, 1:06 PM
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż - avatar
0
Oooh I see did not even see that đŸ˜ČđŸ˜čđŸ€­đŸ€­ thank you very much
31st Mar 2021, 12:45 AM
AckĂžh Bwoy
AckĂžh Bwoy - avatar