What is the behavior of the pop method when there is only one item left on the Stack?

Question

For this exercise, what will be the behavior of the pop() method when only one item remains on the Stack?

Answer

The pop() method will capture the current top item in the stack using the item_to_remove variable. The default behavior of the Node class is to set the next_node value to None. When pop() then updates self.top_item to the next node for item_to_remove, it will update the value to None which will indicate that the Stack is empty.

Isn’t pop() a last in - first out operation?