Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def oddnumbers():
- n = 1
- while True:
- yield n
- n += 2
- def pi_series():
- odds = oddnumbers()
- approximation = 0
- while True:
- approximation += (4 / next(odds))
- yield approximation
- approximation -= (4 / next(odds))
- yield approximation
- approx_pi = pi_series()
- for i in range(1000):
- print(next(approx_pi))
Add Comment
Please, Sign In to add comment