how to do average in python list code example
Example 1: average value of list elements in python
# Example to find average of list
number_list = [45, 34, 10, 36, 12, 6, 80]
avg = sum(number_list)/len(number_list)
print("The average is ", round(avg,2))
Example 2: python get average of list
#python3
def average(list):
result = sum(list) / len(list)
return result
list = [68,68,71,71,71,75,71,78,91,98,75,71,84]
print(average(list))