Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calc_pi(acc):
- pos = False
- sum = 4.0
- for i in range(2, acc):
- if not pos:
- sum -= 4.0/(2*i-1)
- pos = True
- else:
- sum += 4.0/(2*i-1)
- pos = False
- return float(sum)
- print(calc_pi(5000))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement