Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Oct 12th, 2018 58 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  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