+ 1
Failed in 2 case
i = str(input()) noise_list = i.split(" ") animal = [] for noise in noise_list: if 'Grr' in noise_list: animal.append('Lion') elif 'Rawr' in noise_list: animal.append('Tiger') elif 'Ssss' in noise_list: animal.append('Snake') elif 'Chirp' in noise_list: animal.append('Bird') else: continue animal_str = ' '.join(animal) print(animal_str)
2 Answers
+ 2
May be it is the order you are appending, what if you change the conditions in your for loop to sth like this
if noise == "Grr"
and change 'animal' from list to string ( i feel it is easier)
animal = ""
.
.
.
if noise == "Grr"
animal += " Lion"
0
Try entering:
Grr Chirp