title: Calculating Pi to the Nth digit
body: <p>I'm trying to enter in a number and  calculate pi to that digit input. I managed to be able to calculate Pi, however no matter what number I type it will still generate the same amount of Pi numbers.</p>
  <p>I'm a bit confused at what point it's causing to do that</p>
  <pre><code>from math import factorial
  from decimal import Decimal, getcontext
  # Chudnovsky algorithm for figuring out pi
  getcontext().prec=100
  
  pi_input = input('How many digits of pi would you like?')
  n = int(pi_input)
  
  def calc(n):
      t= Decimal(0)
      pi = Decimal(0)
      deno= Decimal(0)
  
      for k in range(n):
          t = ((-1)**k)*(factorial(6*k))*(13591409+545140134*k)
          deno = factorial(3*k)*(factorial(k)**3)*(640320**(3*k))
          pi += Decimal(t)/Decimal(deno)
      pi = pi * Decimal(12) / Decimal(640320 ** Decimal(1.5))
      pi = 1/pi
      return pi
  
  print calc(n)
  </code></pre>
  <p>Here is my output</p>
  <pre><code>How many digits of pi would you like? 5 
  
  3.141592653589793238462643383279502884197169399375105820974944592307816346
  94690247717268165239156011
  </code></pre>