Public feed #721243

Mine

public text v1 · immutable
Raw Edit
·published 2007-10-01 02:34 UTC
rendered paste body
Question: 

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 . 

My Attempt:

for k in temps:
	total += temps[k]

avg_temp = total / len(temps)