0

remove function

https://code.sololearn.com/coU5hRkUDu82/#py why does 'remove' only the first occurring element ??

5th Apr 2020, 1:40 PM
Mani
Mani - avatar
2 odpowiedzi
+ 3
You can define a function to achieve your task . def remove(x,y): for i in range(len(x)): try: x.remove(y) except: continue return x #take (x) argument as list #and take (y) argument as the string to remove
5th Apr 2020, 2:03 PM
Tricker