Question #196890

Write a program that takes a list of integers as a parameter and returns the sum of the list without using the built-in ‘sum()’ function.


Expert's answer

def mysum(L):
    s = 0
    for x in L:
        s += x
    return s

L = [12345]
print(f'The sum of the list {L} is {mysum(L)}')

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!

LATEST TUTORIALS
APPROVED BY CLIENTS