Friday 12 February 2021

Practical No. 19: Write a menu driven program which insert delete and display the details of a Club with cid, cname and city using stack.

 

'''

Practical No. 19: Write a menu driven program which insert delete and display the

details of a Club with cid, cname and city using stack.

'''

Club= []

c='y'

while (c=="y" or c=="Y"):

    print("1: Add Club Details: ")

    print("2: Delete Club Details: ")

    print("3: Display Club Details: ")

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

    if (choice == 1):

      cid = int(input("Enter Club Id: "))

      cname = input("Enter Club Name: ")

      city = input("Enter Club City: ")

      clu = (cid,cname,city)

      Club.append(clu)

    elif (choice==2):

      if(Club == []):

         print(" Stack Empty ")

      else:

         print("Delete Element is : ", Club.pop())

    elif (choice == 3):

      L = len(Club)

      while (L>0):

       print(Club[L-1])

       L=L-1

    else:

         print("Wrong Input")

    c= input("Do you want to continue? Press 'y' to continue:")

         

      






No comments:

Post a Comment