Tuesday, November 19, 2019

pop method in python

pop method removes the last element of the python and also return the which element is deleted

l1=[10, 30, 40, 50, 60, 70]
print(l1.pop())
print(l1)
print(l1.pop())
print(l1)

output:
70
[10, 30, 40, 50, 60]
60
[10, 30, 40, 50]

No comments:

Post a Comment

python class topic video