id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

bryce.hulett@hotmail.com python_list_2 > remove_all
prev  |  next  |  chance

Write a function named remove_all that accepts as a parameter a list of strings along with an element value string, and returns a new list that is the same as the parameter list but with all occurrences of that string removed. For example, if a list named l contains ["a", "b", "c", "b", "b", "a", "b"], the call of remove_all(l, "b") should return ["a", "c", "a"].


remove_all(['a', 'b', 'c', 'b', 'b', 'a', 'b'], 'b') → ['a', 'c', 'a']
remove_all(['x', 'y', 'z', 'y', 'x'], 'x') → ['y', 'z', 'y']
remove_all(['cat', 'dog', 'cat', 'bird'], 'cat') → ['dog', 'bird']

...Save, Compile, Run (ctrl-enter)

def remove_all(strings, val):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 290 Post-solution available

Copyright Nick Parlante 2017 - privacy