PYTHON: Making an array with n-many elements
<p>I am trying to write a program that will first ask for the number of inputs, then will ask for the value of each input. I need to find the mean and root-mean-square of the values from input, so I am trying to make an array of n-many (usually 2, but up to 6) elements.
I am having trouble setting up this array since I don't know how many elements it will have.
I have tried several different ways to make it work. This is my latest attempt:</p>

<pre><code>N = input("How many inputs: ")
i=1
a = []
while i &lt;= N:
    a.append = input("Enter value for flux: ")
    i = i+1
</code></pre>

<p>Surely there is something simple that I am missing; this seems like something that would be common.</p>

<p>there you go.</p>

<pre><code>N = input("How many inputs: ")
a = []
for _ in xrange(N):
    a.append(input("Enter value for flux: "))
</code></pre>

python arrays