Cumulative Average in Python

Problem Statement:

In Cumulative Average in Python, we are given a list of numbers and we need to find the cumulative average of numbers. The cumulative average is the average of increasing numbers in the list(here). To know more about the cumulative average, click here.

Code for Cumulative Average in Python:

numbers = [1, 2, 3, 4, 5, 6, 7, 8]
avg = []
for i in range(len(numbers)):
    check = 0
    l = i + 1
    for j in range(i+1):
        check += numbers[j]
    avg.append(check/l)
print(avg)
print(sum(avg))

Output:

Cumulative Average in Python

Also Read:

Share:

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at admin@violet-cat-415996.hostingersite.com Thank you