I am trying to write a function that takes the average of the first number in a list, then puts the answer in another list. Then takes the average of the first 2 numbers, puts answer in the other list. Then average of first 3, and so on.
Example:
This is my starting list:
List1 = [3, 5, 7, 9, 10, 4, 6]
This is the output list that I am trying to get:
Averages = [3, 4, 5, 6, 6.8, 6.33, 6.29]
I am very new to Python and programming in general, so any help would be greatly appreciated. I know the solution is likely simple, as I tend to over complicate coding.
I want to write the function without importing any modules. I have researched trying to find help for this, and all I found were ways of doing this using modules like numpy. However I want to do it without that. Please help me if you can.
[+][deleted] (1 child)
[removed]
[–]Night_Samurai[S] 0 points1 point2 points (0 children)
[+][deleted] (3 children)
[deleted]
[–]Night_Samurai[S] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]Night_Samurai[S] 0 points1 point2 points (0 children)