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)

6th Mar 2018, 4:58 PM
santosh hulbutti
santosh hulbutti - avatar
7 odpowiedzi
+ 1
[3,4,1,1]
6th Mar 2018, 5:06 PM
Sylar
+ 1
[3,4,1,1] list.remove(n) where n is element present in the list. removes element's first occurence from the list.
6th Mar 2018, 5:09 PM
Manorama
Manorama - avatar
+ 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.
6th Mar 2018, 5:14 PM
Sylar
+ 1
okay I didn't know.
6th Mar 2018, 5:15 PM
santosh hulbutti
santosh hulbutti - avatar
0
it removes only first occuring object in the list
6th Mar 2018, 5:07 PM
santosh hulbutti
santosh hulbutti - avatar
0
It's alright. :) We all didn't know when using this app for first time. Happy coding and challenges!
6th Mar 2018, 5:18 PM
Sylar
0
1,4, 1, 1
6th Mar 2018, 6:23 PM
Subin Chandran