daily pastebin goal
85%
SHARE
TWEET

Untitled

a guest Oct 12th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2.  
  3. import itertools as it
  4.  
  5. class pi_computing_device(object):
  6.     def __init__(self, iterations):
  7.         self.n = iterations
  8.  
  9.     def compute_pi(self):
  10.         coefficients = it.cycle((1, -1))
  11.         divisors = it.islice(it.count(1), 0, self.n, 2)
  12.         return 4*sum(c * 1.0/d for c, d in it.izip(coefficients, divisors))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top