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

rate = regularRate

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

                      savingsBalance = None

                      while True:
                          print("\nMenu:")
                          print("1. Open a Savings Bank Account")
                          print("2. Deposit Money")
                          print("3. Withdraw Money")
                          print("4. Open a Fixed Deposit")
                          print("5. Exit")

                          choice = int(input("Enter your choice (1-5): "))

                          if choice == 1:
                              savingsBalance = openSavingsAccount()
                          elif choice == 2:
                              depositMoney(savingsBalance)
                          elif choice == 3:
                              withdrawMoney(savingsBalance)
                          elif choice == 4:
                              fixedDeposit()
                          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, modify, delete a question
                         Register the student before allowing her or 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 the final score
                  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

                      def addQuestion(quizData):


                                                                                                        Dictionaries  445
   454   455   456   457   458   459   460   461   462   463   464