Tuesday, July 31, 2018

Python 3: real sum of list

#sum of list exercise
#© GPC™ 2018
ni = int(input("how many items on the list?"))
mylist = []

while len(mylist) < ni:
    n = int(input("?"))
    mylist.append (n)
    sumtotal = sum(mylist)
print (sumtotal)

No comments:

Post a Comment

Exprima-se livremente!