def get_average(temp_base):
 if (not hasattr(get_average, 'temp')):
  get_average.temp = [temp_base, temp_base, temp_base]
 get_average.temp[2] = get_average.temp[1]
 get_average.temp[1] = get_average.temp[0]
 get_average.temp[0] = temp_base
 temp_avg = (((get_average.temp[0] + get_average.temp[1]) + get_average.temp[2]) / 3)
 return temp_avg

def get_average ( temp_base ) : if ( not hasattr ( get_average , 'temp' ) ) : get_average . temp = [ temp_base , temp_base , temp_base ] get_average . temp [ 2 ] = get_average . temp [ 1 ] get_average . temp [ 1 ] = get_average . temp [ 0 ] get_average . temp [ 0 ] = temp_base temp_avg = ( ( ( get_average . temp [ 0 ] + get_average . temp [ 1 ] ) + get_average . temp [ 2 ] ) / 3 ) return temp_avg
use moving average to get better readings .