TypeError: object () takes no parameters

Screen Link:

https://app.dataquest.io/m/352/object-oriented-python/8/attributes-and-the-init-method

My Code:

class NewList(DQ):
        def _init_(self, initial_state):
            self.data = initial_state

my_list = NewList([1, 2, 3, 4, 5])
print(my_list.data)

class NewList(DQ):
def init(self, initial_state):
self.data = initial_state

my_list = NewList([1, 2, 3, 4, 5])
print(my_list.data)```

What I expected to happen:

I thought it would work. I believed that I copied the answer exactly. I can’t see a difference.

What actually happened:

TypeErrorTraceback (most recent call last)
in ()
3 self.data = initial_state
4
----> 5 my_list = NewList([1, 2, 3, 4, 5])
6 print(my_list.data)

TypeError: object() takes no parameters

TypeErrorTraceback (most recent call last)
<ipython-input-1-cf45fa7b5692> in <module>()
      3         self.data = initial_state
      4 
----> 5 my_list = NewList([1, 2, 3, 4, 5])
      6 print(my_list.data)

TypeError: object() takes no parameters
Variables

Hi David,

I believe this is happening because you have only one underscore before and after init (_init_) instead of two (__init__), and for this reason the Python interpreter things you haven’t defined any parameters (because it’s looking for that in __init__, which isn’t there).

I hope this helps!

JoshDQ,

Thank you.

David