title: Calculating polynomials in Python?
body: <p>I really don't have code to post with this, since I'm pretty stuck on how to write it. I have to give a list of positive ints and an x value to replicate the following example:</p>
  
  <pre><code>&gt;&gt;&gt; poly([1, 2, 1], 2)
  9
  &gt;&gt;&gt; poly([1, 0, 1, 0, 1], 2)
  21
  &gt;&gt;&gt; poly([1, 0, 1, 0, 1], 3)
  91
  </code></pre>
  
  <p>The equation I have is <code>p(x) = a0 + a1x + a2x**2 + a3x**3 + ... + anx**n</code>, so an idea I had was checking the length of the list and making it so that it automatically determined how many calculations it had to do, then just replacing x with whatever value was outside the list. Unfortunately I don't know how to write that or where to start really.</p>