How can I write this same function using recursion?
def replace(thelist,a,b):
"""Returns: a COPY of thelist but with all occurrences of a replaced by b.
Example: replace([1,2,3,1], 1, 4) = [4,2,3,4].
Precondition: thelist is a list of ints
a and b are ints"""
I believe I'm supposed to make a copy of the original, and then from there make a = b in the list, but I do not know how to implement that. Please help me solve this, and thank you!