Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
hub
/
github.com/itcharge/AlgoNote
/ peek
Method
peek
codes/python/03_stack_queue_hash_table/stack_link_stack.py:31–35 ·
view source on GitHub ↗
(self)
Source
from the content-addressed store, hash-verified
29
30
# 获取栈顶元素
31
def
peek(self):
32
if
self.is_empty():
33
raise
Exception(
'Stack is empty'
)
34
else
:
35
return
self.top.value
36
37
38
stack = Stack()
Callers
1
stack_link_stack.py
File · 0.45
Calls
1
is_empty
Method · 0.95
Tested by
no test coverage detected