How can I get the average of a range of inputs?
<p>I have to create a program that shows the arithmetic mean of a list of variables. There are supposed to be 50 grades. </p>

<p>I'm pretty much stuck. Right now IÂ´ve only got:</p>

<pre><code>for c in range (0,50):
    grade = ("What is the grade?")
</code></pre>

<p>Also, how could I print the count of grades that are below 50?</p>

<p>Any help is appreciated.</p>

<p>If you don't mind using <code>numpy</code> this is ridiculously easy: </p>

<pre><code>import numpy as np
print np.mean(grades)
</code></pre>

<p>Or if you'd rather not import anything,</p>

<pre><code>print float(sum(grades))/len(grades)
</code></pre>

<p>To get the number of grades below 50, assuming you have them all in a list, you could do: </p>

<pre><code>grades2 = [x for x in grades if x &lt; 50]
print len(grades2)
</code></pre>

python