+ 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")
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 = ' ')
+ 3
Thank you š