Friday, 12 February 2021

Practical No. 16: Write a menu driven program which insert, delete and display the details of a student such as roll_no,sname and course using stack.

 

'''

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

details of a student such as roll_no,sname and course using stack.

'''

Student=[]

c='y'

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

    print("1 : Add Student Details : ")

    print("2 : Delete Student Details : ")

    print("3 : Display Student Details : ")

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

    if(choice==1):

          roll_no=int(input("Enter Student Roll no: "))

          sname=input("Enter Student Name: ")

          course=input("Enter Student Course: ")

          stu=(roll_no, sname, course)

          Student.append(stu)

    elif(choice==2):

          if(Student==[]):

                 print("Stack Empty")

          else:

                 print("Deleted Element is : ", Student.pop())

    elif(choice==3):

          L=len(Student)

          while(L>0):

                 print(Student[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