array = [0, 1, 2, 3, 4] array.pop(0) # Remove first array array.pop(1) # Remove second array array.pop(-1) # Remove last array
Here is what the above code is Doing:
1. We create an array with 5 elements.
2. We remove the first element from the array.
3. We remove the second element from the array.
4. We remove the last element from the array.
The output of the code will be:
[1, 2, 3]
As you can see, the first, second, and last elements have been removed from the array.