0
Output of the following program?
Toplist=[1, 3, 4, 2, 3, 4, 1, 1] Toplist.remove(1) Toplist.remove(2) Toplist.remove(3) Toplist.remove(4) print(Toplist)
7 Réponses
+ 1
[3,4,1,1]
+ 1
[3,4,1,1]
list.remove(n) where n is element present in the list. removes element's first occurence from the list.
+ 1
Since you already know the 'why' of your question, then this post is similar to challenge. Sorry to say this, you shouldn't post challenge like this in Q&A section. There's a challenge/lesson section for posting related to them. I heard it is only available for android though.
+ 1
okay I didn't know.
0
it removes only first occuring object in the list
0
It's alright. :) We all didn't know when using this app for first time. Happy coding and challenges!
0
1,4, 1, 1