+1 vote
in Class 12 by kratos

Write a function in python, MakePush(Package) and MakePop(Package) to add a new Package and delete a Package from a List of Package Description, considering them to act as push and pop operations of the Stack data structure.

1 Answer

+1 vote
by kratos
 
Best answer

def MakePush(Package):

a=int(input("enter package title : "))

Package.append(a) def MakePop(Package):

if (Package==[]):

print( "Stack empty")

else:

print ("Deleted element:",Package.pop())

...