+ 1

What is the problem with the code below?

Code: it says "no output". sound = input() for x in sound: if x == "Grr": print("Lion") if x == "Rawr": print("Tiger") if x =="Ssss": print("snake") if x== "Bird": print("Chirp")

19th Jul 2022, 6:53 AM
No One
2 Answers
+ 5
No One 1 - you have to split input to get list sound = input().split() 2 - add end = ' ' in print function to avoid printing in new line 3 - 's' is capital in 'snake' 4 - print 'Bird' when 'Chirp' --------- #What is the problem with the code below? #Code: it says "no output". sound = input().split() for x in sound: if x == "Grr": print("Lion", end = ' ') if x == "Rawr": print("Tiger", end = ' ') if x =="Ssss": print("Snake", end = ' ') if x== "Chirp": print("Bird", end = ' ')
19th Jul 2022, 6:58 AM
AĶ¢J
AĶ¢J - avatar
+ 3
Thank you šŸ˜Š
19th Jul 2022, 7:02 AM
No One