From 6089fcad60465482188bd94e95bd0a0991d3845a Mon Sep 17 00:00:00 2001 From: Jose Salvatierra Date: Mon, 30 Sep 2024 14:32:52 +0100 Subject: [PATCH] Fix stack behaving as a queue as per course video --- .../21_algorithms_data_structures/projects/samples/stack.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/course_contents/21_algorithms_data_structures/projects/samples/stack.py b/course_contents/21_algorithms_data_structures/projects/samples/stack.py index e496dc1..4192238 100644 --- a/course_contents/21_algorithms_data_structures/projects/samples/stack.py +++ b/course_contents/21_algorithms_data_structures/projects/samples/stack.py @@ -3,10 +3,10 @@ def __init__(self): self.items = [] def push(self, e): - self.items.append(e) + self.items = [e] + self.items def pop(self): - return self.items.pop() + return self.items.pop(0) s = Stack()