Yeah, that 'animal' is coming out of nowhere. It's starting to exist in the line with the 'for' loop. It's getting assigned values there. To be annoyingly clear about what's happening, this part here:
for animal in animals:
First translates into this:
for animal in ["ant", "bat", "cat"]:
And it then translates into:
animal = "ant"
animal = "bat"
animal = "cat"
About that thing with the 4 == "cheeseburger" test: the answer for Python is, it will always return False when you compare a number and a string. It does not matter what the values are or the length of the string or whatever. Python's rules are, a number and a string are not the same so it always says False.
In other languages, other things happen. There's languages where you don't get True or False, instead you get an error. The language says you made a mistake trying to compare a number and a string and wants you to change your code before it accepts it.
js> 4 == "4"
js> 4 == "cheeseburger"
Here's what Python does, like I mentioned earlier it just always says a number compared to a string is False:
>>> 4 == "cheeseburger"
>>> 4 == "4"