+ 7
What's wrong with it?
Can't catch mistake (jungle camping code coach) https://code.sololearn.com/cuIE6fk0MHHZ/?ref=app
28 Réponses
+ 5
Look it works.
Just replace i with x in the if else and don't convert your input to string explicitly...
x=input().split(" ")
animals=[]
for i in x:
print(i)
if "Grr" in i:
animals.append("Lion")
elif "Rawr" in i:
animals.append("Tiger")
elif "Ssss" in i:
animals.append("Snake")
elif "Chrip" in i:
animals.append("Bird")
animals_j=" ".join(animals)
print(animals_j)
+ 8
Dananan Bananan andriy kan
Tiger not Tigger
Chirp not Chrip
Now the code should work.
+ 6
Tiger not Tigger ;)
+ 5
I don't know what you expected from your code. I just made it correct.
I commented out input() function and set some value to x
It outputs the result:
[EDITED]: I uncommented the second line with input() function. So you can try it
https://code.sololearn.com/cy4Cj8ZV9vSP
+ 5
Here's a short one
https://code.sololearn.com/cJhmNLBixswO
+ 4
x=input().split(" ")
animals=[]
for i in x:
if "Grr" == i:
animals.append("Lion")
elif "Rawr" == i:
animals.append("Tiger")
elif "Ssss" == i:
animals.append("Snake")
elif "Chirp" == i:
animals.append("Bird")
else:
continue
animals_j=" ".join(animals)
print(animals_j)
+ 3
s=input("")
n=s.split(' ')
for i in n:
if i=='Grr':
print("Lion",end=" ")
elif i=='Rawr':
print("Tiger",end=" ")
elif i=="Ssss":
print("Snake",end=" ")
elif i=="Chirp":
print("Bird",end=" ")
you can try this also...no need to create another list
+ 2
Sorry, I can't understand you.
Did you try the code in code playground that I've posted?
https://code.sololearn.com/cy4Cj8ZV9vSP
I replace input with the string:
"Rawr Chirp Ssss"
Output is:
Tiger Bird Snake
If you want to use user input just uncomment the line #2
+ 2
s=input().split()
for y in s:
if(y=="Grr"):
print("Lion",end=' ')
elif(y=="Rawr"):
print("Tiger",end=' ')
elif(y=="Ssss"):
print("Snake",end=' ')
else:
print("Bird",end=' ')
I done it like this
+ 2
Petro Skulsky, please do not spam.
+ 2
because default represents else in switch case ( if you know if .. else ) when no condition is true it goes to else
the same with switch
here at the example you have 3 different cases and you switch x value
if x == 1 (first case) it will print x value only without any addition
if x == 2 (second case) it will print x value and add 2 to it so the result would be 3 + 2 = 5
will print 5
if x value not equal to 1 or 2 it will go to the default and add 5 to x value so the result would be 8
i hope you understand
gerard
+ 1
С этого и нужно было начинать)
как указал(а) Denise Roßberg у тебя ошибка в слове Tiger.
as Denise Roßberg pointed out, you have a mistake in the word Tiger.
+ 1
Try this
a=input()
lst=[]
sa=a.split()
for i in sa:
if i=='Grr':
lst.append('Lion')
elif i=='Rawr':
lst.append('Tiger')
elif i=='Ssss':
lst.append('Snake')
elif i=='Chirp':
lst.append('Bird')
result=' '.join(lst)
print(result)
+ 1
You need to print "Chirp" instead of "Chrip" and "Tiger" instead of "Tigger"
0
I tried this as well but it results in no output
0
https://www.sololearn.com/coach/45?ref=app
It's from this code coach and for me it still doesn't work
0
I've solved it with end parameter but couldn't solve it with append function
0
Я вводил этот код в jungle camping code coach, 3ий и 5ый тест не исполняются, не получается найти ошибку
0
After I've corrected tiGer mistake the 3rd test in jungle camping does not execute
0
Thank you all! Now it works!