python help

msullivan3's Avatar, Join Date: Apr 2009
Go4Expert Member
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
msullivan3's Avatar, Join Date: Apr 2009
Go4Expert Member
nevermind. never declared certain variables. feel free to delete or close this thread