fork download
  1. def LAcum(L):
  2. a=[]
  3. s=0
  4. for i in range(len(L)):
  5. s += L[i]
  6. a.append(s)
  7. return a
  8.  
  9. def rangosLAcum(L,i,j):
  10. L2=LAcum(L)
  11. if not i:return L2(j)
  12. return L2[j]-L2[i-1]
  13.  
  14.  
  15. L=[1,2,3,4,5,6,7,8,9,10]
  16.  
  17. print(rangosLAcum(L,1,3))
Success #stdin #stdout 0.04s 9648KB
stdin
Standard input is empty
stdout
9