Page 241 - Information_Practice_Fliipbook_Class11
P. 241

print("Selected category not found.")

                          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.  adminUsername = input("Create an admin username: ")
                  adminPassword = input("Create an admin password: ")

                  heritageSites = []


                  while True:
                      adminChoice = int(input("\nAdmin Menu:\n1. Login\n2. Quit\nEnter your choice (1-2): "))

                      if adminChoice == 1:
                          enteredUsername = input("Enter admin username: ")
                          enteredPassword = input("Enter admin password: ")

                          if enteredUsername == adminUsername and enteredPassword == adminPassword:
                              while True:
                                  print("\nAdmin Operations:")
                                  print("1. Add Heritage Site")
                                  print("2. Modify Heritage Site")
                                  print("3. Delete Heritage Site")
                                  print("4. Display Heritage Sites")
                                  print("5. Logout")
                                  adminOperation = int(input("Enter your choice (1-5): "))

                                  if adminOperation == 1:
                                      siteName = input("Enter the name of the heritage site: ")


                                                                                             Python Dictionaries  227
   236   237   238   239   240   241   242   243   244   245   246