Please use PYTHON only and follow all the following instructions carefully. Than
ID: 3872774 • Letter: P
Question
Please use PYTHON only and follow all the following instructions carefully. Thank you
Please make sure that it can pass all the test cases as follows: https://repl.it/Lr2W
Allowing defaults, modifying a list in-place: def remove(val, xs, limit-None): Remove multiple copies of val from xs (directly modify the list value that xs refers to). You may only remove up to the first limit occurrences of val. If limits:3, and xs had ten copies of val in it, then you'd only remove the first three and leave the last seven in place. When limits=None, there's truly no limit (and we remove all occurrences of val). Return None, because the work happened in-place. Negative or zero limit: no removals. o hint: if you need to traverse a list from front to back, but you don't always want to go to the next index location, while loops can be very useful we don't have to step forward each iteration o Note some test cases are multiple lines (which we've avoided so far). You might need to notice the line number of a failed test, and go look at the code of that particular testing function, to see what's being attempted. This is a good habit to get into for projects. o Examples: . >>> xs = [1,2,1,3, 1,4,1,5,1] remove(1,xs) >>>XS [2, 3, 4, 5] . >>> xs = [1,2,1,3, 1,4,1,5,1] >>remove (1,xs,3) >>> XSExplanation / Answer
It passed all the test cases