Good afternoon

Can any one explain why the error "soma = sum + aprox_cos SyntaxError: Invalid syntax" appears and how can I solve it in order to get the requested solution?

Implement a three-parameter function which, for a given angle in degrees (first parameter), a vector N (second parameter), with increasing values of the number of terms of the series to use, computes and returns a vector with the value of the approximation of the cosine function obtained with each Ni of the Taylor series, for the given angle.

The number of decimals to be used in the result for each number of terms is given by the NDec vector (third parameter), where the index i of the vector indicates the number of decimals to be present for the number of terms defined in the table. index i of the vector N The vector N must not be modified by the function.

```
def taylor (ang, N, NDec):
res = []
sum = 0
for i in the range (len (N)):
for k in the beach (len (NDec)):
for j in the beach (N[i]):
taylor = (-1) ** j / (math.factorial (2 * j) * ang ** (2 * j)
sum = sum + approx_cos
total = round (sum, NDec[k]])
res.append (total)
return res
```

I used it on the console

`ang = 180`

`N =[3, 4, 6, 10, 20]`

`NDec =[4, 6, 8, 10, 10]`

The solution is:

```
[0.1239, -1.211353, -1.0018291, -1.0000000035, -1.0]
```

Note:

Thank you to everyone who can help!