Basic-Python-Programs
Basic-Python-Programs copied to clipboard
Add Stack Datastructure with user input
###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.