from math import factorial
def sin_approximation(x, n):result = 0sign = 1for i in range(1, n+1):result += sign * (x*(2i-1) / factorial(2i-1))sign = -1return result
X = 1.0N = 5print(sin_approximation(X, N))
from math import factorial
def sin_approximation(x, n):
result = 0
sign = 1
for i in range(1, n+1):
result += sign * (x*(2i-1) / factorial(2i-1))
sign = -1
return result
X = 1.0
N = 5
print(sin_approximation(X, N))