W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
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))