NP29 用列表实现栈
This commit is contained in:
parent
ed9e1847f8
commit
603ffc167f
18
NP/NP29.py
Normal file
18
NP/NP29.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# @author 轩辕龙儿
|
||||||
|
# @date 2022/10/26
|
||||||
|
# @file NP29.py
|
||||||
|
|
||||||
|
def solution():
|
||||||
|
num = int(input())
|
||||||
|
stack = [1, 2, 3, 4, 5]
|
||||||
|
stack.pop()
|
||||||
|
print(stack)
|
||||||
|
stack.pop()
|
||||||
|
print(stack)
|
||||||
|
stack.append(num)
|
||||||
|
print(stack)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
solution()
|
Loading…
Reference in New Issue
Block a user