What goes in the blank?
# removes and returns the last element of the list stack = [1, 2, 3] last = stack.____() # last == 3, stack == [1, 2]
Answer: pop
pop() with no argument removes and returns the last list element.
Play Problem Solving ▸
# removes and returns the last element of the list stack = [1, 2, 3] last = stack.____() # last == 3, stack == [1, 2]
Answer: pop