Answers for "find the average of a list using a for loops python"

12

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))
Posted by: Guest on February-14-2020
1

how to calculate average in list python by using whil loop

def avg(list):
    s = 0
    total = 0.0
    while(s < len(list)):
        total = total + list[s]
        s = s+1
    return total/len(list)
ans = avg([1, 2, 3, 4, 5])
print(ans)
Posted by: Guest on December-06-2020

Code answers related to "find the average of a list using a for loops python"

Python Answers by Framework

Browse Popular Code Answers by Language