+ 1

Why it delete the last element of list?

>>> lst=[1,2,3,4,5,6,7,8,9] >>> lst.pop() >>> print(lst) [1,2,3,4,5,6,7,8]

22nd Jul 2020, 4:03 AM
Samba_Chinta
Samba_Chinta - avatar
7 Respostas
+ 4
Pop() without any parameter(index) will remove last element from the list...
22nd Jul 2020, 4:28 AM
Indira
Indira - avatar
+ 4
Samba Yes
22nd Jul 2020, 5:11 AM
Indira
Indira - avatar
+ 2
With no parameter, it default is to delete last one
22nd Jul 2020, 5:07 AM
Samba_Chinta
Samba_Chinta - avatar
+ 2
If you call pop without arguments it deletes an item at index -1 by default.
22nd Jul 2020, 8:46 AM
Seb TheS
Seb TheS - avatar
+ 1
Pop() is used to delete the elements If u use without index it will automatically delete last element in the list
22nd Jul 2020, 4:13 AM
Sâgærāvürï
Sâgærāvürï - avatar
0
Pop method property is to eliminate last element.
22nd Jul 2020, 2:19 PM
shubham kumar
shubham kumar - avatar