Write Do Push(Customer) and DoPop(Customer) methods/function in Python to
add a new Customer and delete a Customer from a List of Customer names,
considering them to act as push and pop operations of the Stack data structure.
Answers
Answered by
7
def DoPush(Customer):
Stack.append(Customer)
print("Element : ",Customer," , inserted successfully")
def DoPop():
if Stack == []:
print("Stack is Empty")
else:
print("Deleted element is : ",Stack.pop())
Stack=[]
i = int(input("0 - exit / 1 - Push / 2 - Pop : "))
while (i!=0):
if i==1:
name = input("Enter Customer Name : ")
DoPush(name)
elif i==2:
DoPop()
else:
print("Invalid Choice")
i = int(input("0 - exit / 1 - Push / 2 - Pop : "))
Similar questions