Instead of printing actual values from the Stack object it returns an address of that object.
class Stack: def init(self): self._theItems = list()
def push(self, item):
self._theItems.append(item)
def pop(self):
assert not self.is_empty(), "Cannot pop from an empty stack"
return self._theItems.pop()
def get_top(self):
assert not self.is_empty(), "Cannot peek at an empty stack"
return self._theItems[-1]
def is_empty(self):
return len(self._theItems) == 0
def display(self):
return self