题解 | #用列表实现队列#
用列表实现队列
https://www.nowcoder.com/practice/cc9e56e0d80d44e5990f76196adb4912
stack = [1, 2, 3, 4, 5]
for i in range(2):
stack.pop(0)
print(stack,sep='\n')
stack.append(int(input()))
print(stack)
list.append(x)
在列表末尾添加一个元素,相当于 a[len(a):] = [x]
list.pop([i])
删除列表中指定位置的元素,并返回被删除的元素。未指定位置时,a.pop() 删除并返回列表的最后一个元素。(方法签名中 i 两边的方括号表示该参数是可选的,不是要求输入方括号。这种表示法常见于 Python 参考库)
