Skip to content

Commit 5f49e24

Browse files
committed
Added equality check for Stacks
1 parent 03d6e15 commit 5f49e24

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

stack.py

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ def length(self) -> int:
1616
def __str__(self) -> str:
1717
return str(self._data)
1818

19+
def __eq__(self, other: 'Stack') -> bool:
20+
if self.__class__ == other.__class__:
21+
if self._data == other._data and self._size == other._size:
22+
return True
23+
return False
24+
1925
def is_empty(self) -> bool:
2026
return self._size == 0
2127

0 commit comments

Comments
 (0)