Jungle Camping Issue
I have you versions of code that I have written to try and solve this problem, and whilst both run perfectly fine when I test them in CodeBits, when I run it in the test it fails. noises = input().split() animals = '' for noises in noises: if noises == 'Grr': animals += 'Lion' + ' ' if noises == 'Rawr': animals += 'Tiger' + ' ' if noises == 'Ssss': animals += 'Snake' + ' ' if noises == 'Chirp': animals += 'Bird' + ' ' print(animals) - For this one it says that variable 'noises' as not been defined, yet it still says this when I try " for n in noises" noises = input().split() animals = '' for n in range(len(noises)): if noises[n] == 'Grr': animals += 'Lion' + ' ' if noises[n] == 'Rawr': animals += 'Tiger' + ' ' if noises[n] == 'Ssss': animals += 'Snake' + ' ' if noises[n] == 'Chirp': animals += 'Bird' + ' ' print(animals) - For this second one, when the input is 'Grr' 'Grr' it outputs: Lion Lion Lion - Yet in my CodeBits test run it does not do this and runs the correct output of: Lion Lion I am confused.