More with 'for' - where did the "animal" come from in the example?


#1



https://www.codecademy.com/courses/python-beginner-en-pwmb1/1/6?curriculum_id=4f89dab3d788890003000096


animals = ["cat", "ant", "bat"]
animals.sort()

for animal in animals:
print animal

where did they get that word animal? did they create that?


Replace this line with your code.


#2

we create/define animal in the loop. Then python will assign each value from the list to the iterator (in this case animal)


#3

Thanks- right after I posted I realized!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.