Answer to Question #196890 in Python for Tony

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.


1
Expert's answer
2021-05-25T00:11:33-0400
def mysum(L):
    s = 0
    for x in L:
        s += x
    return s

L = [1, 2, 3, 4, 5]
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS