import math def sin(x,n): z = 0 for i in range(n+1): z = z + ( (-1)**i / math.factorial(2*i+1) ) * x**(2*i+1) return float("{:.4f}".format(z))