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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!