Skip to content

Commit 8939a6f

Browse files
szabopetersangamcse
authored andcommitted
stack.py: Add IndexError
Fixes #294
1 parent 347ad07 commit 8939a6f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

stack/Python/stack.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ def pop(self):
2424
"""
2525

2626
if len(self.stack) <= 0:
27-
# Raise an error if stack is empty.
28-
return "No element in the Stack"
27+
raise IndexError("No element in the Stack")
2928

3029
else:
3130
return self.stack.pop()

0 commit comments

Comments
 (0)