#Chapter 44 SumList.py #iterative routine def sumList(numList): sum = 0 for i in numList: sum = sum + i #endfor return sum #recursive routine def sumListRecursive(numList): if len(numList) ==1: return numList[0] else: return numList[0] + sumListRecursive(numList[1:]) #main program numbers = [3, 5, 10, 2] total = sumList(numbers) print('Sum =',total) total = sumListRecursive(numbers) print('Using a recursive routine:') print('Sum =',total)