https://www.bing.com/ck/a?!&&p=b771e5024b394ed7JmltdHM9MTcxMzEzOTIwMCZpZ3VpZD0wMTA1NWM1My03YzlkLTY4NDYtMjQzZC00Zjg5N2QzMDY5MzMmaW5zaWQ9NTM4Nw&ptn=3&ver=2&hsh=3&fclid=01055c53-7c9d-6846-243d-4f897d306933&psq=stack+data+structure+in+python&u=a1aHR0cHM6Ly9zdGFja2FidXNlLmNvbS9ndWlkZS10by1zdGFja3MtaW4tcHl0aG9uLw&ntb=1
https://youtu.be/lfNfGR3BZHM?si=aAmJ9I9Znm60QB4_
https://youtu.be/AKO9nI4tuhs?si=GEEV6bDICxvOf1fM
Implement a Python class called
Stack
to represent a stack data structure. The class should have the following methods:
push(item)
: Add an item to the top of the stack.pop()
: Remove and return the item at the top of the stack.peek()
: Return the item at the top of the stack without removing it.is_empty()
: Return True if the stack is empty, False otherwise.size()
: Return the number of items in the stack.You can choose to implement the stack using a list or linked list.