Question: Write a recursive function sum_list (nums) that calculates the sum of numbers in a list, the parameter nums is a list of integers. If the

Write a recursive function sum_list (nums) that calculates the sum of numbers in a list, the parameter nums is a list of integers. If the list is empty it return None. Your function should work with the following driver code: if __name_ =="_main_": listA =[] list B=[3] listC =[1,2,3,4] assert sum_list ( listA) == None assert sum_list(listB) ==3 assert sum_list (listC) ==10 print('Everything works correctly!')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
