#STACKS PROGRAM
#[Link] XIIF2
shares = []
def isEmpty(shares):
if shares==[]:
return True
else:
return False
def push(shares):
company_name = input("Enter Company Name: ")
cust_name = input("Enter Customer Name: ")
no_of_shares = int(input("Enter Number of Shares: "))
amt_per_share = float(input("Enter Amount per Share: "))
[Link]((company_name, cust_name, no_of_shares, amt_per_share))
print("Record pushed")
def pop(shares):
if isEmpty(shares):
print("Stack empty, UNDERFLOW CASE")
else:
print("Popped record:", [Link]())
def display(shares):
if isEmpty(shares):
print("Stack empty, UNDERFLOW CASE")
else:
print("Stack contents:")
for record in shares:
print(record)
def menu():
while True:
print("\nMENU DRIVEN PROGRAM:")
print("1. Push")
print("2. Pop")
print("3. Display")
print("4. Quit")
choice = input("Enter your choice (1-4): ")
if choice == "1":
push(shares)
elif choice == "2":
pop(shares)
elif choice == "3":
display(shares)
elif choice == "4":
print("Exiting program.")
break
else:
print("Invalid choice. Please try again.")
menu()