MCPcopy
hub / github.com/donnemartin/interactive-coding-challenges / pop

Method pop

stacks_queues/stack/stack.py:16–21  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

14 self.top = Node(data, self.top)
15
16 def pop(self):
17 if self.top is None:
18 return None
19 data = self.top.data
20 self.top = self.top.next
21 return data
22
23 def peek(self):
24 return self.top.data if self.top is not None else None

Callers 10

test_hanoiMethod · 0.95
test_end_to_endMethod · 0.95
test_stack_minMethod · 0.80
test_set_of_stacksMethod · 0.80
test_sort_stackMethod · 0.80
test_pop_on_emptyMethod · 0.80
test_stacksMethod · 0.80
extract_minMethod · 0.80
extract_minMethod · 0.80
extract_minMethod · 0.80

Calls

no outgoing calls

Tested by 7

test_hanoiMethod · 0.76
test_end_to_endMethod · 0.76
test_stack_minMethod · 0.64
test_set_of_stacksMethod · 0.64
test_sort_stackMethod · 0.64
test_pop_on_emptyMethod · 0.64
test_stacksMethod · 0.64