Set 2

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

def Push(stk,item):

stk.append(item)

print("Element added in a stack...")

def Pop(stk):

if stk==[]:

print("Underflow case... Can not delete the element..")

else:

print("Element Deleted:",stk.pop())

def Display(stk):

if stk==[]:

print("Stack is empty..")

else:

for i in range(len(stk)-1,-1,-1):

print(stk[i])

Stack=[]

while True:

print("Stack Operations")

print("1.PUSH")

print("2.POP")

print("3.DISPLAY")

print("4.EXIT")

ch=int(input("Enter your choice:"))

if ch==1:

Ename=input("Enter the Employee name:")

Esalary=int(input("Enter the salary of the Employee:"))

rec=[Ename,Esalary]

Push(Stack,rec)

elif ch==2:
Pop(Stack)

elif ch==3:

Display(Stack)

elif ch==4:

break

You might also like