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()
