MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / push

Method push

data_structures/stacks/__init__.py:10–16  ·  view source on GitHub ↗
(self, item)

Source from the content-addressed store, hash-verified

8 return (self.top == 0)
9
10 def push(self, item):
11 if self.top < len(self.stack):
12 self.stack[self.top] = item
13 else:
14 self.stack.append(item)
15
16 self.top += 1
17
18 def pop(self):
19 if self.is_empty():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected