0
Can't debug it. Any help?
3 Antworten
+ 1
Mas-ud Al-hassan
What if there is "Grr Rawr Grr" ?
Your output would be:
Lion Lion
because in if else condition only one part will be execute.
So Try this:
str = input()
list = str.split()
for i in list:
if i == 'Grr':
print("Lion", end = " ")
elif i == 'Rawr':
print("Tiger", end = " ")
elif i == 'Ssss':
print("Snake", end = " ")
elif i == 'Chirp':
print("Bird", end = " ")
+ 3
You could also use a dictionary
https://code.sololearn.com/cPy5Bu5JitGv
0
It works now. But why using 'for loop'? I mean suppose the inputs are 'Grr Rawr Grr', what the first loop would do?