Question: Python: Create a function called subtract that takes two lists and returns a list that has all of the elements in the first that are
Python: Create a function called subtract that takes two lists and returns a list that has all of the elements in the first that are not in the second. This function must not remove values from either of the original lists. [15 marks] (note: to copy the contents of a list use stuff = otherStuff[:]).
2. Create a function called subtract that takes two lists and returns a list that has all of the elements in the first that are not in the second. This function must not remove values from either of the original lists. [15 marks] (note: to copy the contents of a list use stuff = otherStuff[:]). Sample input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 6, 8] Sample output: [1, 3, 4, 5, 7, 9, 10]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
