Q. Write a menu driven python program using queue, to implement movement of shuttlecock in it’s box.


Answer :-


queue = [ ]
data = 0 
while True :
    print()
    print("Enter your choise as per given -")
    print("1 = For insert dshuttlecock ")
    print("2 = For remove shuttlecock")
    print("3 = For Exit ")
    print()
    user = input("Enter your choise :- ")
    if user == "1" :
        data += 1
        queue.append(data)
    elif user == "2" :
        if queue == [ ]:
            print("UnderFlow")
        else :
            queue.pop(0)
    else :
        break
    print("Now our Queue = ",queue)

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post