 # syntax error

It’s telling me that there’s a syntax error on line ten. Can anyone help me?

def extended_synthetic_division(dividend, divisor):

# dividend and divisor are both polynomials

out = list(dividend) # Copy the dividend
normalizer = divisor
xrange = (len(dividend)-(len(divisor)-1)
for i in xrange(len(dividend)-(len(divisor)-1)
out[i] /= normalizer

# normalize by dividing the coefficient with the divisor’s first coefficient

coef = out[i]
if coef != 0: # useless to multiply if coef is 0
for j in xrange(1, len(divisor)): # skip the first coefficient of the divisor,

# because it’s only used to normalize the dividend coefficients

out[i + j] += -divisor[j] * coef

# return the quotient and remainder.

separator = -(len(divisor)-1)
return out[:separator], out[separator:] # return quotient, remainder.

if __name__ == ‘__main__’:
print (“POLYNOMIAL SYNTHETIC DIVISION”)
N = [-2, -3, 4, 5]
D = [1, 2]
print (" %s / %s =") % (N,D),
print (" %s remainder %s") % extended_synthetic_division(N, D)

Hi and welcome @mcropper14 ,

First of all, it would be really handy if you could post your code in a good way over here. Because especially with Python the indents are important as well. You also reference line numbers, which aren’t visible here in the Community. Since people are a bit lazy by default your post won’t get the engagement it deserves if you make it hard for them to answer your question. I created a Gist (without indentation, sadly) to make things a bit more clear:

As for the syntax error, this is line 9:

``````for i in xrange(len(dividend)-(len(divisor)-1)
``````

Have you tried changing that to:

``````for i in xrange(len(dividend)-(len(divisor)-1)):
``````

(adding a **) **and  : at the end of the line. I think that will fix it.