Question: Challenge problem: Deep Cleaning with Recursion! This problem demonstrates something that truly requires recursion! The removeAll function above does this: def removeAll ( e ,
Challenge problem: Deep Cleaning with Recursion! This problem demonstrates something that truly requires recursion! The removeAll function above does this:
def removeAlle L:
takes in an element e and a list L Then, removeAll should return another list that is identical to L except that all elements identical to e have been removed'
if lenL:
return
if L e:
return removeAlle L:
else:
return L removeAlle L:
removeAll
In other words, in this example, it removes all of the s from the list, but it does not remove s that are embedded in lists within that list. Your job here is to write a function called deepRemoveAll that scours its input and removes not only the desired item, but also removes that item deep inside other lists. Here are a few examples:
deepRemoveAll
deepRemoveAll
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
