On 14/04/13 06:53, Soliman, Yasmin wrote:
How can I calculate the average of a list of numbers (eg [2,5,8,7,3] ) and then
subtract the avg from the original numbers in the list and print?
You calculate the average by summing the list, then dividing by the number of
items.
To sum a list of n
On 13/04/13 21:53, Soliman, Yasmin wrote:
How can I calculate the average of a list of numbers (eg [2,5,8,7,3] )
> and then subtract the avg from the original numbers
> in the list and print?
This sounds like homework which we don;t do for you.
However to calculate the average take the sum and
On 13/04/2013 21:53, Soliman, Yasmin wrote:
How can I calculate the average of a list of numbers (eg [2,5,8,7,3] ) and then
subtract the avg from the original numbers in the list and print?
lst = [2,5,8,7,3]
avg = sum(lst) / len(lst)
print(avg)
for n in lst:
print(n - avg)
Also, if I ha
How can I calculate the average of a list of numbers (eg [2,5,8,7,3] ) and then
subtract the avg from the original numbers in the list and print?
Also, if I have a nested list:
sick_patients=[['Sam', 'M', 65, 'chest pain', 101.6], [['Sarah', 'F', 73,
'dizziness', 98.6], [['Susie', 'F', 34, 'he