Answers for "how to find the average of numbers in a loop python"

1

how to average in python with loop

list = input('Input a list of numbers separated by comma then space:n ')
try:
    list = list.split(', ')
    sum = 0
    
    for number in list:
        sum = int(number) + sum

    avg = sum / len(list)
    print('The average of the numbers you entered is: ', avg)
except ValueError:
    print('Please enter a list of number separated by a comma and space only')
Posted by: Guest on September-04-2021

Code answers related to "how to find the average of numbers in a loop python"

Python Answers by Framework

Browse Popular Code Answers by Language