stack = []
list1 = []
# 首先输入两个数字
a = int(input())
b = int(input())
# 分别按照栈和队列的形式进入两个列表
stack.append(a)
stack.append(b)
list1.append(a)
list1.append(b)
# 打印两个列表
print(stack)
print(list1)
# 弹出栈中的一个元素和队列中的一个元素
stack.pop()
list1.pop(0)
# 打印两个列表
print(stack)
print(list1)
# 再次输入三个数字
a = int(input())
b = int(input())
c = int(input())
# 分别按照栈和队列的形式进入两个列
stack.append(a)
stack.append(b)
stack.append(c)
list1.append(a)
list1.append(b)
list1.append(c)
# 打印两个列表
print(stack)
print(list1)
# 最后依次弹出栈中元素并按顺序输出
tmp = ''
while len(stack):
tmp += str(stack.pop())
tmp += ' '
print(tmp)
收获
while len(stack):
# tmp += str(stack.pop())
# tmp += ' '
print(stack.pop(),end=' ')