diff --git a/languages/python/calculators/pi.py b/languages/python/calculators/pi.py new file mode 100644 index 0000000..eb55d4e --- /dev/null +++ b/languages/python/calculators/pi.py @@ -0,0 +1,12 @@ +import math + +pi = 0 + +for k in range(20): + numerator = (2 ** k) * (math.factorial(k) ** 2) + denominator = math.factorial((2 * k) + 1) + + pi += numerator / denominator + +pi *= 2 +print(pi) diff --git a/languages/python/chunkArray.py b/languages/python/chunkArray.py index a90204d..7206d66 100644 --- a/languages/python/chunkArray.py +++ b/languages/python/chunkArray.py @@ -8,4 +8,4 @@ def chunkArray(array, chunkCount): return chunks -print(chunkArray([1,2,3,4,5,6], 3)) +print(chunkArray([1,2,3,4,5,6], 4))