0

Good Day,

So I have an object called PointArray and another object called Graph. I am passing the object point to Graph as such

class Graph:
    def __init__(self):
        self.pointArray = PointArray()
    description = "This is a class"
    author      = "Raaj"

    def setPointArray(self,pointArray):
        self.pointArray=pointArray

    def plotFFTGraph(self):
        xArr=[]
        yArr=[]
        for point in self.pointArray.freqArray
            xArr.append(point.X)
            yArr.append(point.Y)

        subplot(2,1,2)
        plot(xArr,yArr)

The problem is, Python doesn't seem to recognize that I can access freqArray!

I get this

for point in self.pointArray.freqArray
                                     ^
SyntaxError: invalid syntax

I have imported everything correctly. What gives this error?

1
  • Read what the error message is saying. If it couldn't recognize that you could access freqArray, it would give you something like an AttributeError: 'Spam' object has no attribute 'freqArray'. But it's saying SyntaxError: invalid syntax—that means there's something wrong with your punctuation. Commented Nov 1, 2013 at 21:52

2 Answers 2

3

You forgot the colon:

for point in self.pointArray.freqArray:
    #                  ---------------^
Sign up to request clarification or add additional context in comments.

1 Comment

I am new to the language. apologize for that
0

Change it to for point in self.pointArray.freqArray:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.