8000 Merge pull request #41 from miron/stack · ccaj007/complete-python-course@e9ff0d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit e9ff0d5

Browse files
authored
Merge pull request tecladocode#41 from miron/stack
stack behaves like queue, fixed
2 parents 26b6d18 + b61c19b commit e9ff0d5

File tree

1 file changed

+2
-2
lines changed
  • course_contents/21_algorithms_data_structures/projects/samples

1 file changed

+2
-2
lines changed

course_contents/21_algorithms_data_structures/projects/samples/stack.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ def push(self, e):
66
self.items = [e] + self.items
77

88
def pop(self):
9-
return self.items.pop()
9+
return self.items.pop(0)
1010

1111

1212
s = Stack()
1313
s.push(5) # [5]
1414
s.push(7) # [7, 5]
1515
s.push(11) # [11, 7, 5]
1616
print(s.pop()) # returns 11, left is [7, 5]
17-
print(s.pop()) # returns 7, left is [5]
17+
print(s.pop()) # returns 7, left is [5]

0 commit comments

Comments
 (0)
0