#addNumsR is a recursive version of a subroutine to add a list of numbers #addNumsI is an iterative version of a subroutine to add a list of numbers def addNumsR(numbers): if len(numbers) == 1: return numbers[0] else: return numbers[0] + addNumsR(numbers[1:]) #ENDSUB def addNumsI(numbers): sum = 0 for index in range(len(numbers)): sum = sum + numbers[index] return sum print ("Recursive routine") marks = [3, 6, 2, 8, 1] total = addNumsR(marks) print ("Total: ",total) print ("Iterative routine") marks = [3, 6, 2, 8, 1] total = addNumsI(marks) print ("Total: ",total)