title: arctan(x) function in python
body: <p>The Write a function that will return an approximate value for pi by evaluating the equation  pi = arctan(1/5) - arctan(1/239), where arctan is the tangent function from the math library . Im using python 3.4.1</p>
  
  <p>The function I used was:</p>
  
  <pre><code>def wallis(pairs):
      acc = 1
      num = 2
      for apair in range(pairs):
          leftterm = math.atan(0.2)
          rightterm = math.atan(0.0041)
  
          acc = leftterm - rightterm
  
          return pi
  </code></pre>
  
  <p>but it didn't work. It's confusing.</p>