Contact: aviboots(AT)netvision.net.il
40,898 questions
53,328 answers
573 users
def average(lst): return sum(lst) / len(lst) if lst else 0 lst = [3.14, 8.0, 2.87, 5.982, 10.0] print (average(lst)) ''' run: 5.9984 '''
import statistics lst = [3.14, 8.0, 2.87, 5.982, 10.0] print (statistics.mean(lst)) ''' run: 5.9984 '''