Untitled
Boss
python
2 years ago
332 B
1
Indexable
Never
mas=[1,2,3,4,5] s1=0 for i in range(len(mas)): s1+=mas[i] print(s1) j=len(mas)-1 s2=0 while j>=0: s2+=mas[j] j-=1 print(s2) def sum1(lst): s3 = 0 for i in lst: if (type(i) == type([])): s3 = s3 + sum1(i) else: s3 = s3 + i return s3 print(sum1(mas))