remove function | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
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
1 ответ
+ 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