Ошибка: TypeError: 'map' object is not subscriptable,

Как добавить сумму 3-х чисел по индексу?

Нерабочий вариант:

a = int(input())
n = map(int, input().split())
r =[]
N1 = 0
N2 = 2
for i in range(a):
    r.append(sum(n[0:2]))
    if 0 <= N2 < len(n):
        N1 += 1
        N2 += 1
    else:
        break
print (max(r))

Ответы (0 шт):