Question: 3. Implement function processList2(inputList, specialltem, ignoreltems) that returns a new list that contains all the items of inputList (and in the original order) except 1)

3. Implement function processList2(inputList, specialltem, ignoreltems) that returns a new list that contains all the items of inputList (and in the original order) except 1) any that appear in the list ignoreltems, and 2) occurrences of specialltem (if specialltem is not in ignoreltems) should become the string "special" in the new list. Use a one-line list comprehension to construct the new list. Thus again, the function will have exactly two lines, the def line and a return line containing a list comprehension expression. For example, >processList2(11,2,3,4], 4, [3]) [1, 2, 'special' processList2([1,2,3,4,True, 'dog'], 4, [3,5,4]) [1, 2, True, 'dog' ] >>> proce s sList2( [ 1 , i , 2 , 2 ] , 1 , [ 2 ] ) 'special', special'1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
