Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = float(input())
- def factorial(x):
- if x == 0:
- return 1
- else:
- return x * factorial(x - 1)
- pi = 3.14159265359
- x = x - int(x / pi)//2 * 2*pi
- cos = 0
- if x > pi:
- x -= 2 * pi
- for n in range(20):
- cos += ((-1) ** n * x ** (2*n)) / (factorial(2*n))
- print(cos)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement