MCPcopy
hub / github.com/ndleah/python-mini-project / push

Method push

Stack_structure/main.py:10–19  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

8 self.top = None
9
10 def push(self, data):
11 print(f"Adding {data} to the top of the stack")
12
13 # If there is no data, we add the value in the top element and return
14 if self.top == None:
15 self.top = Node(data)
16 return
17 new_node = Node(data)
18 new_node.next = self.top
19 self.top = new_node
20
21 def pop(self):
22 # If there is no data in the top node, we return

Callers 13

main.pyFile · 0.45
oeFunction · 0.45
tFunction · 0.45
weFunction · 0.45
TeFunction · 0.45
CeFunction · 0.45
oFunction · 0.45
kFunction · 0.45
SFunction · 0.45
xeFunction · 0.45
ptFunction · 0.45

Calls 1

NodeClass · 0.70

Tested by

no test coverage detected