Q. Write a program to perform insert and delete operations on a Queue containing Members' details as given in the following definition of item node:
Member No - Integer
Member Name - String
Age - Integer
def isEmpty (Qu) :
if Qu == [ ] :
return True
else :
return False
def Enqueue (Qu, item) :
# Write the code to insert member details using Queue.
def Dequeue (Qu) :
# Write the code to delete a member using Queue.
Answer =
def isEmpty (Qu) : if Qu == [ ] : return True else : return False def Enqueue (Qu, item) : Qu.append(item) def Dequeue (Qu) : Qu.pop(0) Qu = [ ] while True : print() print("Enter your choise as per given -") print("1 = For insert data Enter insert ") print("2 = For delete data enter delete ") print("3 = For Exit enter exit ") print() user = input("Enter your choise :- ") if user == "insert" : memno = int(input("Enter the number of member :-")) memna = input("Enter the name of member :-") age = int(input("Enter the Age :-")) data = [ memno , memna , age ] Enqueue (Qu, data) elif user == "delete" : if isEmpty (Qu): print("UnderFlow") else : Dequeue (Qu) else : break print("Now our Queue = ",Qu)
:Write a program to insert and delete operations on Stack containing Members
ReplyDeletedetails as given in the following definition of itemnode:
Member no integer
Member name string
Age integer
Can you answer for this one
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )