+ 2

Calculating average in python using a function.

How do i create a while loop function that keeps adding numbers entered by the user, adding them then outputing the average?

27th Jun 2019, 12:10 PM
Daniel Akama
1 Réponse
+ 2
Here's a way: #Get user input and insert it into a list #Calculate the sum of list by the builtin function sum() #Calculate the number of elements in the list by the builtin function len() #divide the sum by the len *try to do it and let me know if you get stuck at any point
27th Jun 2019, 12:38 PM
Mo Hani
Mo Hani - avatar