title: Python: area of a regular polygon
body: <p>I'm trying to calculate the area of a "regular polygon" (a regular polygon means that all sides of the polygon are the same).  I created a method to do it, however, it seems to be off by "1" and I can't seem to figure out why.</p>
  
  <pre><code>import math
  
  if __name__=="__main__":
  
      num_sides = int(input("Enter the number of sides: "))
      side_length = float(input("Enter the side: "))
  
      def polygon_area(n_sides, length):
          area = (n_sides * (length ** 2)) / (4 * math.tan((math.pi) / n_sides))
          print(area)
  
      polygon_area(num_sides, side_length)
  </code></pre>
  
  <p>here is the formula I'm using to find the area of a regular polygon given 1 side
  <a href="https://i.stack.imgur.com/77yWC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/77yWC.png" alt="enter image description here"></a></p>
  
  <p>here is the expected output that i am supposed to get</p>
  
  <p><a href="https://i.stack.imgur.com/UntPD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UntPD.png" alt="enter image description here"></a></p>
  
  <p>So the expected result is supposed to be <strong>73</strong>.69017017488385, but I get <strong>72</strong>.69017017488385.  I thought it could be the order of operations or how the user input was being handled but they seem ok.  I'm not sure at this point why it's off by 1.</p>