Printing a list from a class in Python
<p>My simplified code is below: it creates an animal, and places it inside a zoo. I want to print the list of animals within the zoo. Going round in circles with this! </p>

<pre><code>class Animal(object):

    def __init__(self, name):
        self.name = name

class Zoo(object):

    def __init__(self):
        self.animals = []

    def __str__(self):
        rep = ", ".join(self.animals)
        return rep

    def add(self, name):
        self.animals.append(Animal(name))

def main():

    while True:
        zoo = Zoo()
        animal = input("add an animal: ")
        zoo.add(animal)
        print(zoo)

main()
</code></pre>