5/19 Runtime Error



Here is my code:

class Animal(object):
    def __init__(self, name):
        self.name = name
    zebra = Animal("Jeffrey")
    print zebra.name

Upon submission, I see the following:

File "python", line 4, in init
RuntimeError: maximum recursion depth exceeded while calling a Python object

Oops, try again. Did you declare a variable called zebra?

Can anyone help me with this, please?

Okay, now the runtime error is gone even though nothing changed. However, I have a new error message:

Traceback (most recent call last):
File "python", line 1, in
File "python", line 5, in Animal
NameError: name 'Animal' is not defined


Solved! Indentation issue. :slight_smile:


Yup! Indentation on last two lines.

Good you discovered that. :slight_smile: