Solution: implement the my_sum function
def my_sum(*numbers):
s = 0
for n in numbers:
s += n
return s
print(my_sum()) # 0
print(my_sum(2, 3)) # 5
print(my_sum(-1, 2, -1,)) # 0
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
def my_sum(*numbers):
s = 0
for n in numbers:
s += n
return s
print(my_sum()) # 0
print(my_sum(2, 3)) # 5
print(my_sum(-1, 2, -1,)) # 0