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 Answers
+ 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