list.remove delete first object in the list, but not all similar objects. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

list.remove delete first object in the list, but not all similar objects.

how delete all objects like 'p' in list ['p', 4, 'g', 'p', 'u', 'p']?

24th Dec 2017, 7:42 AM
Vladislav Lubomski
Vladislav Lubomski - avatar
1 Answer
+ 1
Put the delete command into a while loop(or any other loop) that iterates until there is a 'p' in the list.
21st Dec 2020, 11:40 AM
Duane Francis Rodrigues
Duane Francis Rodrigues - avatar