Lesson 05-09: Building List Functions: removeall

Learning Target: I can create a python function that will remove all elements of a given value.

Assignment

In the area below, create a method called removeAll() that will take in two arguments:

  • original - the original list
  • del_value - the value you want to replace in the list

and will remove ALL elements that in original that match del_value. The function should modify the value of original.

Example:

removeAll([1,2,1,2,3,1,2],1) should return [2,2,3,2]

 
1
def removeAll(orig,del_value):
2
    #write here
3
4

(cfu_0508_1)

Hints

Next Section - Lesson 05-10: Strings to Lists