+ 3

What is the basic difference between pop and remove? Does pop remove the last element of the set?

18th Jan 2016, 6:09 PM
Suraj Kumar
Suraj Kumar - avatar
2 Respuestas
+ 1
set={1,2,3,4,5,6,7,8,9,} remove= It removes the specific element from the set, whic you have specified ...like remove(5) in this the element #5 will be removed from the above set. set={1,2,3,4,6,7,8,9,} pop= It removes a random element from the above remaining items in the set.
27th Feb 2016, 12:06 PM
Abhishek Singh
0
set.pop[index] remove items by their index. if you don't put an index it removes last item by default. unlike set.remove(x) which removes specific item.
22nd Jan 2016, 12:25 PM
Mohamed Mustafa
Mohamed Mustafa - avatar