Syntax Error and I'm not seeing it

Screen Link:
https://app.dataquest.io/m/352/object-oriented-python/10/creating-and-updating-an-attribute

My Code:

class NewList(DQ):
    def __init__(self, initial_state):
        self.data = initial_state
        self.calc_length()
      
    def calc_length(self):
        length = 0
        for item in self.data:
            length += 1
        self.length = length
    
    def append(self, new_item):
        self.data = self.data + [new_item]
        self.calc_length()
              
fibonacci = NewList([1,1,2,3,5])
print(fibonacci.length()
      
fibonacci.append(8)
print(fibonacci.length)

What I expected to happen:
It would run and give me the correct output.

What actually happened:

  File "<ipython-input-1-7f6c7f553c46>", line 22
    fibonacci.append(8)
            ^
SyntaxError: invalid syntax

I’m not seeing the error so I would love some insight on what I’m missing.

You’re missing a closing parenthesis in the line immediately above the one indicated.

Thank you – I knew it was something that I just couldn’t see myself and needed another view!

1 Like

Screen link:
got a little confused with this mission because i didn’t think you could call a method
before the method definition.
The calc_length method was called before it was defined

Hey. Is there a question here? Can you please ask it in a new topic and make it more explicit?