Page 244 - Information_Practice_Fliipbook_Class11
P. 244

siteNameToSearch = input("Enter the name of the heritage site to search: ")

                      for site in heritageSites:
                          if site['name'].lower() == siteNameToSearch.lower():
                              print("\nInformation for '{}':".format(siteNameToSearch))
                              print("Name: {}".format(site['name']))
                               print("Location: {}, {}".format(site['location']['district'], site['location']
                               ['state']))
                              print("Built Year: {}".format(site['builtYear']))
                              print("Built By: {}".format(site['builtBy']))
                              print("Purpose: {}".format(site['purpose']))
                              print("Website Link: {}".format(site['websiteLink']))
                              break
                      else:
                          print("'{}' not found in the list of heritage sites.".format(siteNameToSearch))


                  elif userChoice == 2:
                      stateToSearch = input("Enter the state to display heritage sites: ")

                      print(f"\nHeritage Sites in {stateToSearch}:")
                      for site in heritageSites:
                          if site['location']['state'].lower() == stateToSearch.lower():
                              print("Name: {}".format(site['name']))
                               print("Location: {}, {}".format(site['location']['district'], site['location']
                               ['state']))
                              print("Built Year: {}".format(site['builtYear']))
                              print("Built By: {}".format(site['builtBy']))
                              print("Purpose: {}".format(site['purpose']))
                              print("Website Link: {}".format(site['websiteLink']))
                              print("")

                  elif userChoice == 3:
                      print("Quitting the program.")
                      break

                  else:
                      print("Invalid choice. Please enter a number between 1 and 3.")



                                                       Answers

          Multiple Choice Questions
          1. (c)      2. (a)     3. (b)     4. (c)      5. (b)     6. (c)     7. (c)      8. (d)     9. (b)
          10. (c)
          True or False
          1. (T)      2. (F)     3. (F)     4. (T)      5. (F)     6. (T)     7. (F)
          Fill in the blanks
          1. 2                   2. False               3. rollnoMarks.pop(4)

          4. [12, 25, 32, 60, 78, 90]                   5. 5                  6. None


          230  Touchpad Informatics Practices-XI
   239   240   241   242   243   244   245   246   247   248   249