Get your own Python server Result Size: 625 x 565
x
 
stack = []
# Push
stack.append('A')
stack.append('B')
stack.append('C')
print("Stack: ", stack)
# Peek
topElement = stack[-1]
print("Peek: ", topElement)
# Pop
poppedElement = stack.pop()
print("Pop: ", poppedElement)
# Stack after Pop
print("Stack after Pop: ", stack)
# isEmpty
isEmpty = not bool(stack)
print("isEmpty: ", isEmpty)
# Size
print("Size: ",len(stack))
Stack: ['A', 'B', 'C']
Peek: C
Pop: C
Stack after Pop: ['A', 'B']
isEmpty: False
Size: 2