Answers for "py list pop()"

2

pop function in python

#pop() function
L1 = [20,4,-6,38,-12]
print(' pop', L1.pop())
print('List ', L1)
x=L1.pop(2)
print(' popped:', x)
print('final List :', L1)
#output:
pop -12
List  [20, 4, -6, 38]
popped: -6
final List : [20, 4, 38]
Posted by: Guest on December-20-2021
1

list pop method in python

l1 = [1, 8, 7, 2, 21, 15]
l1.pop(2) # removes element at index 2

print(l1)
Posted by: Guest on January-12-2022

Python Answers by Framework

Browse Popular Code Answers by Language