题解 | #用列表实现队列#
用列表实现队列
https://www.nowcoder.com/practice/cc9e56e0d80d44e5990f76196adb4912
queue = [1, 2, 3, 4, 5] for i in range(3): if i == 2: queue.append(int(input())) print(queue) else: queue.pop(0) print(queue)
用列表实现队列
https://www.nowcoder.com/practice/cc9e56e0d80d44e5990f76196adb4912
queue = [1, 2, 3, 4, 5] for i in range(3): if i == 2: queue.append(int(input())) print(queue) else: queue.pop(0) print(queue)
相关推荐