Write a python function that takes a list from the user and then calculates the average of the list.
def ave3():
list2 = []
sum2=0
z = int(input("size of the list"))
for i in range (z):
inn = int(input("enter the element"))
list2.append(inn)
for i in range (z):
sum2=sum2+list2[i]
a = sum2 / z
print("average of the list = {}".format(a))
ave3()
Comments
Post a Comment