How To Find Average Of Unlimited numbers in python

''' Here we a going to write a python program which can give us the average of the numbers given '''

print("Enter the numbers ")

list = []

i  =  1 

while(True):
    xi = input("Enter the  Number ->    ")
    i += 1
    if xi != 'Done':
        list.append(float(xi))
    else:
        break

print(list)

length = len(list)

# Now we are going to obtain the sum of all the numbers of the list

sum = 0  
for i in range(length):
    sum += list[i]

avg = sum/length 

print("The average of the numbers entered is -> " , avg )


Comments

Popular posts from this blog

goal