Page 462 - Computer Science V2.0 Class 11
P. 462

else:
                                print("Incorrect admin credentials. Please try again.")
                        elif adminChoice == 2:
                            print("Quitting the program.")
                            break
                        else:
                            print("Invalid choice. Please enter a number between 1 and 2.")

                    while True:
                         studentChoice  = int(input("\nStudent  Menu:\n1. Register\n2.  Play Quiz\n3. Quit\nEnter
                        your choice (1-3): "))

                        if studentChoice == 1:
                            studentName = registerStudent()
                        elif studentChoice == 2:
                            if quizData:
                                selectedCategory = selectCategory(quizData)
                                playQuiz(quizData, selectedCategory, studentName)
                            else:
                                 print("No quiz questions available. Please ask the admin to add questions.")
                        elif studentChoice == 3:
                            print("Quitting the program.")
                            break
                        else:
                            print("Invalid choice. Please enter a number between 1 and 3.")
                 3.  Our heritage monuments are our assets. They are a reflection of our rich and glorious past and an inspiration for our future. UNESCO has
                    identified some of Indian heritage sites as World heritage sites. Collect the following information about these sites:
                       What is the name of the site?
                       Where is it located?
                       ▪ District
                       ▪ State
                       When was it built?
                       Who built it?
                       Why was it built?
                       Website link (if any).
                    Write a Python program to
                       create an administrative user ID and password to add, modify or delete an entered heritage site in the list of sites
                       display the list of world heritage sites in India
                       search and display information of a world heritage site entered by the user
                       display the name(s) of world heritage site(s) on the basis of the state input by the user.
               Ans.  def createAdminAccount():
                        adminUsername = input("Create an admin username: ")
                        adminPassword = input("Create an admin password: ")
                        return adminUsername, adminPassword

                    def adminLogin(adminUsername, adminPassword):
                        enteredUsername = input("Enter admin username: ")
                        enteredPassword = input("Enter admin password: ")
                        return enteredUsername == adminUsername and enteredPassword == adminPassword


               448   Touchpad Computer Science (Ver. 2.0)-XI
   457   458   459   460   461   462   463   464   465   466   467