How can an average equation be added to this?
<p>I am taking GCSE programming and have be set a task to create a program which takes "n" amount of numbers and works out the average.</p>

<pre><code>#presets for varibles 
nCount = 0
total = 0
average = 0.0
Numbers = []
ValidInt = False

#start of string
nCount = (input("How many numbers? "))
print(nCount)
while not ValidInt:
    try:
        int(nCount)
        ValidInt = True
    except:
        nCount = input("Please Enter An Interger Number")
#validation loops untill an interger is entered
for x in range (int(nCount)):
    Numbers.append(input("Please Enter The Next Number"))
</code></pre>

<p>This is what i have so far but cannot think how i can code it to work out an average from this information?  Any help is much appreciated, Thank you(i am not looking for answers just help in what function as i should use)</p>

<p>You're <em>really</em> close to the answer. Looks like you've got everything setup and ready to calculate the average, so very good job.<br>
Python's got two built-in functions <code>sum</code> and <code>len</code> which can be used to calculate the sum of all the numbers, then divide that sum by how many numbers have been collected. Add this as the last line in your program and check the output.  </p>

<p>Note: Since inputs were taken as integers (whole numbers) and the average will usually be a non-whole number, we make one of the numbers a float before calculating the average:</p>

<p><code>print(sum(Numbers)/float(len(Numbers)))</code></p>

<p>Edit: <em>Or</em>, since you've got a variable that already holds how many numbers the user has input, <code>nCount</code>, we can use this calculation, which will give the same answer:</p>

<p><code>print(sum(Numbers)/float(nCount))</code>.</p>

<p>Try both and choose one or make your own.</p>

python average