File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change 88 It needs no parameters and returns the item. The stack is modified.
99peek() returns the top item from the stack but does not remove it.
1010 It needs no parameters. The stack is not modified.
11- isEmpty () tests to see whether the stack is empty.
11+ is_empty () tests to see whether the stack is empty.
1212 It needs no parameters and returns a boolean value.
13- size() returns the number of items on the stack.
14- It needs no parameters and returns an integer.
1513"""
1614from abc import ABCMeta , abstractmethod
1715class AbstractStack (metaclass = ABCMeta ):
@@ -72,15 +70,15 @@ def push(self, value):
7270
7371 def pop (self ):
7472 if self .is_empty ():
75- raise IndexError ("stack is empty" )
73+ raise IndexError ("Stack is empty" )
7674 value = self ._array [self ._top ]
7775 self ._top -= 1
7876 return value
7977
8078 def peek (self ):
8179 """returns the current top element of the stack."""
8280 if self .is_empty ():
83- raise IndexError ("stack is empty" )
81+ raise IndexError ("Stack is empty" )
8482 return self ._array [self ._top ]
8583
8684 def _expand (self ):
You can’t perform that action at this time.
0 commit comments