Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python3 no imports are allowed! 6. destructiveRemoveRepeats(L) [10 pts] Important Note: this is the analog of the previous important note. Here, to receive any credit
python3
no imports are allowed!
6. destructiveRemoveRepeats(L) [10 pts] Important Note: this is the analog of the previous important note. Here, to receive any credit for this problem, you may not simply call nondestructiveRemoveRepeats(L) and then somehow remove all the elements in L and then append the elements from that call. Instead, you must destructively modify the list as you go. Also, again, note that the autograder has no way to check this, so our TA's will check this manually after the hw deadline. Write the function destructiveRemoveRepeats(L), which implements the same function destructively. Thus, this function should directly modify the provided list to not have any repeating elements. Since this is a destructive function, it should not return any value at all (so, implicitly, it should return None). For example: L = [1, 3, 5, 3, 3, 2, 1, 7, 5] assert (destructiveRemoveRepeats (L) == None) assert(L == [1, 3, 5, 2, 7]) # destructive! == def testDestructiveRemoveRepeats(): print("Testing destructiveRemoveRepeats()...", end="") a = [1,3,5,3,3,2,1,7,5] assert (destructiveRemoveRepeats(a) None) assert(a == (1,3,5,2,7]) b = [1,2,3,-2] assert (destructiveRemoveRepeats(b) None) assert(b [1,2,3,-2]) print("Passed.") ==Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started