Question: Hi! this question needs to be solved in python. I'm very noob to python. Please help me with this. Task 3A - Recursive function Write
Hi! this question needs to be solved in python. I'm very noob to python. Please help me with this.
Task 3A - Recursive function Write a recursive function copy_list (lst) that takes in a list through the parameter lst. The function should return a new list that is a copy of the submitted list. Think recursively! The solution must have an explicit recursion case. Running example from the Python prompt for a properly implemented function: >>> old_list = [1, 2, 3, 4] >>> new_list = copy_list (old_list) >>> new_list [1, 2, 3, 4] >>> new_list.append (5) >>> new_list [1, 2, 3, 4, 5] >>> old_list [1, 2, 3, 4] Note! The implementation must be recursive to be approved. It is not enough with an iterating loop construction or just a slice.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
