Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Stack Datastructure with user input #524

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Bhakti23-CE
Copy link

###Summary:
This PR introduces a new Python program that implements a stack class with various operations, allowing user interaction.

###Features added:
Stack class with methods:

  • push: Pushes an item onto stack.
  • pop: Pop the top item of the stack and handle empty stack case.
  • peek: Returns the top element of stack without removing and checks if stack is empty.
  • is_empty: Checks if the stack is empty.
  • size: Returns the current size of the stack.
  • print_stack: Prints the elements present in stack.

Main Function:

  • Provides menu with options to perform stack operations.
  • Handles invalid inputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant