9:
import random
debug = True
i = 0
ls = []
r = random.randint(5, 40)
while i < r:
tmp = []
t = random.randint(1, 20)
ii = 0
while ii < t:
tmp.append(random.randint(1, 20))
ii += 1
ls.append(tmp)
i += 1
if debug == True:
print(ls)
sm = 0
while i < len(ls)-1:
if i % 2:
sm += sum(ls[i])
print(sm)
10:
ls = [] #ваш массив
mx = ls.index(max(ls))
mn = ls.index(min(ls))
i = mx
while i < mn:
sm += ls[i]
9:
import random
debug = True
i = 0
ls = []
r = random.randint(5, 40)
while i < r:
tmp = []
t = random.randint(1, 20)
ii = 0
while ii < t:
tmp.append(random.randint(1, 20))
ii += 1
ls.append(tmp)
i += 1
if debug == True:
print(ls)
i = 0
sm = 0
while i < len(ls)-1:
if i % 2:
sm += sum(ls[i])
i += 1
print(sm)
10:
ls = [] #ваш массив
mx = ls.index(max(ls))
mn = ls.index(min(ls))
i = mx
sm = 0
while i < mn:
sm += ls[i]
i += 1
print(sm)