Sunday, 8 January 2017

basic numeric functions performing on list



#defining list
l=[]

#storing flag in one variable
ch='y'

#giving condition
while ch!='n':
    n=int(input('enter number:'))  #accepting values from user
    ch=input("do u want to continue:") #taking choice from user
    l.append(n)  #appending the values in list

#displaying list
print("list of values:" ,l)
print("length of list:",len(l))
print("sum of numbers from list:",sum(l))
print("minimum number from list:",min(l))
print("maximum number from list:",max(l))
print("average of numbers from list:",sum(l)/len(l))




No comments:

Post a Comment