python pop a element by index 1

python pop a element by index

a = ['a', 'b', 'c', 'd']
a.pop(1)

# now a is ['a', 'c', 'd']

Here is what the above code is Doing:
1. We create a list called a with four items.
2. We call the pop() method on a and pass in the index of the item we want to remove.
3. The item at index 1 is removed from the list.

Similar Posts