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 ответов
+ 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