Skip to content

Instantly share code, notes, and snippets.

@plotti
Created September 9, 2021 08:08
Show Gist options
  • Save plotti/3904dc4a1568db78be1eb491184471cf to your computer and use it in GitHub Desktop.
Save plotti/3904dc4a1568db78be1eb491184471cf to your computer and use it in GitHub Desktop.
# dein code hier :)
students = ["Max", "Monika", "Monika", "Franz"]
def remove_all(list, element):
while element in list:
list.remove(element)
return list
def remove_all2(list,element):
for item in list:
if item == element:
list.remove(element)
return list
def remove_all3(list,element):
output = []
for item in list:
if item != element:
output.append(item)
return output
remove_all(students,"Monika")
remove_all2(students,"Monika")
remove_all3(students,"Monika")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment