Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5f49e24

Browse files
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

Lines changed: 6 additions & 0 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /