Moving Average by desty

r={}t=0;i=1;while''do s=io.read()r[i]=s:sub(7)t=t+r[i]-(r[i-5]or 0)print(s.format('%s Average: %.1f',s,t/math.min(5,i)))i=i+1;end

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page