Question: Need python coding. Need to use while loop and remove. Write a function deleteall(L, x) to delete all occurrences of the item x from the

Need python coding. Need to use "while" loop and "remove".

Write a function deleteall(L, x) to delete all occurrences of the item x from the list L. The function should change the list L in place and not return anything. Use the docstring """Deletes all occurrences of item x from list L""". Do not change the main program.

Expected output: ['A', 'l', 'h', 'm', 'b', 'r']

P.S. Recall our discussion from 4.5 and do not use the for loop.

# Main program (do not change):

L = ['A', 'l', 'h', 'a', 'm', 'b', 'r', 'a']

deleteall(L, 'a')

print(L)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!