SumListnums function nums is a list of numbers The function

SumList(nums) function, nums is a list of numbers. The function returns the sum of the numbers in the list. You must use an accumulator variable. When correctly implemented, the following test() function will generate 10$ def test(): nums = list(range(15)) print(sumList(nums)) test()

Solution

def sumList(nums):
sum = 0
for num in nums:
sum = sum + num
return sum

def test():
nums = list(range(15))
print(sumList(nums))

test()

 SumList(nums) function, nums is a list of numbers. The function returns the sum of the numbers in the list. You must use an accumulator variable. When correctl

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site