Skip to content

Commit

Permalink
stack.py: Add IndexError
Browse files Browse the repository at this point in the history
Fixes #294
  • Loading branch information
szabopeter authored and sangamcse committed Oct 14, 2018
1 parent 347ad07 commit 8939a6f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions stack/Python/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def pop(self):
"""

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

else:
return self.stack.pop()
Expand Down

0 comments on commit 8939a6f

Please sign in to comment.