Lab#4 Ex1_chap8_and_ex3_chap10

#Ecercice 3 chapter 10
#
def add_all(t):
total=0
for x in t:
total=total+x
return total
def cumulativesum(listnum):
cumsum=[ ]
istr=1
i=int(istr)
n=len(listnum)
while i<n:
xlist=listnum[0:i]
s1=add_all(xlist)
s=list(s1)
import append
cumsum.append(s)
i=i+1
return cumsum
str_int=input(‘Enter a list of integer numbers : ‘)
cumul=cumulativesum(str_int)
print(‘The cumulative sum list is: ‘, cumul)

 

Leave a Reply

Your email address will not be published.