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