for range – invalid syntax of loop

Issue

def amp1(array):
    for i in range (0,len(array),400)
    amp1 [array]= abs(max(array[i:i+400]))
    return amp1

print(amp1(node1[3]))

I get this response:

File "<ipython-input-53-972793b81fd0>", line 7
    for i in range (0,len(array),400)
                                     ^
SyntaxError: invalid syntax

Solution

You are missing a ":" at the end of line 7.
Let try like:

def amp1(array): 
    for i in range (0,len(array),400): 
        amp1 [array]= abs(max(array[i:i+400])) 
    return amp1

print(amp1(node1[3]))

Answered By – kingkong

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.