Answers for "mean of list of list python"

0

mean of a list python

l = [15, 18, 2, 36, 12, 78, 5, 6, 9]

# By using the built-in statistics library
import statistics
statistics.mean(l)  # 20.11111111111111

# By defining a custom function
def average(my_list):
  return sum(my_list) / len(my_list)
average(l) # 20.11111111111111
Posted by: Guest on September-04-2021

Python Answers by Framework

Browse Popular Code Answers by Language