Write a menu driven program to create a list of products and push the product
names and price as a node, whose prices are below 500 into the stack. Also pop all
the elements as well as display the elements. List description: [pid, pname, price]
stk=[]
l=[]
def products():
n=int(input("enter no. of records: "))
for i in range(n):
pid=int(input("enter product id: "))
pname=input("enter product name: ")
price=int(input("enter price: "))
[Link]([pid,pname,price])
def push():
for i in l:
if i[-1]<500:
[Link]([i[1],i[-1]])
for i in range(len(stk)-1,-1,-1):
print(stk[i])
else:
print("stack bottom")
def pop():
if len(stk):
while stk:
print([Link]())
else:
print("stack empty ")
else:
print("underflow")
print("""(i) Add products
(ii) To push elements into stack
(iii) To pop elements of a stack """)
c=input("enter a choice: ")
if c=='1':
products()
elif c=='2':
push()
elif c=='3':
pop()
else:
print("Invalid choice")
print()