Answer to Question #256500 in Python for rasi

Question #256500

program to Get max. consecutive sum of 2 numbers in a list?


1
Expert's answer
2021-11-03T00:47:05-0400
from random import randint
elem = randint(2, 20)
L = list()
for _ in range(elem):
	L.append(randint(1,9))
print(L)
max = 0
for i in range(len(L) - 1):
	if L[i] + L[i + 1] > max:
		max = L[i] + L[i + 1]
print(max)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS