python pop item from array code example
Example 1: python pop
# Python list method pop() removes
# and returns last object or obj from the list.
# .pop() last element .pop(0) first element
my_list = [123, 'Add', 'Grepper', 'Answer'];
print "Pop default: ", my_list.pop()
> Pop default: Answer
# List updated to [123, 'Add', 'Grepper']
print "Pop index: ", my_list.pop(1)
> Pop index: Add
# List updated to [123, 'Grepper']
Example 2: python remove one element from array
array = ["red", "green", "blue"]
del array[0] # this deletes the first element, red, in the array