Page 238 - Information_Practice_Fliipbook_Class11
P. 238

elif choice == 4:
                      print("Opening a Fixed Deposit.")
                      amount = float(input("Enter the deposit amount: "))
                      period = int(input("Enter the deposit period in months: "))
                      seniorCitizenRate = 0.08
                      regularRate = 0.07

                      isSeniorCitizen = input("Are you a senior citizen? (yes/no): ").lower() == "yes"

                      if isSeniorCitizen:
                          rate = seniorCitizenRate
                      else:
                          rate = regularRate

                      maturityAmount = amount * (1 + rate * period / 12)
                      print(f"Fixed Deposit opened successfully with maturity amount: {maturityAmount}")

                  elif choice == 5:
                      print("Exiting the program.")
                      break

                  else:
                      print("Invalid choice. Please enter a number between 1 and 5.")
           2.  Participating in a quiz can be fun as it provides a competitive element. Some educational institutes use it as a tool to measure knowledge
              level, abilities and/ or skills of their pupils either on a general level or in a specific field of study. Identify and analyse popular quiz shows
              and write a Python program to create a quiz that should also contain the following functionalities besides the one identified by you as a
              result of your analysis.
              •  Create an administrative user ID and password to categorically add or modify delete a question.
              •  Register the student before allowing her/him to play a quiz.
              •  Allow selection of category based on subject area.
              •  Display questions as per the chosen category.
              •  Keep the score as the participant plays.
              •  Display final score.
         Ans.  adminUsername = input("Create an admin username: ")
              adminPassword = input("Create an admin password: ")

              quizData = {}


              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 Question")


          224  Touchpad Informatics Practices-XI
   233   234   235   236   237   238   239   240   241   242   243