You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the stack is empty and we call peek method then it will throw "IndexError: list index out of range" error.
You should check for the size of the stack inside peek method before returning the value.