Thread: python help
View Single Post
Go4Expert Member
4Feb2010,09:22  
msullivan3's Avatar
trying to figure out a simple little function

Given a variable temps that refers to a list, all of whose elements refer to values of type float , representing temperature data, compute the average temperature and assign it to a variable named avg_temp . Besides temps and avg_temp , you may use two other variables -- k and total .

i currently have:

for k in range(len(temps)):
total += temps[k]

avg_temp = total / len(temps)

and I cannot figure out what is going and why this isnt working for me