Created
September 9, 2021 08:08
-
-
Save plotti/3904dc4a1568db78be1eb491184471cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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