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

elif 50 <= percentage < 75:
                              return 'C'
                          elif 30 <= percentage <= 50:
                              return 'D'
                          else:
                              return 'Reappear'

                      def main():
                          option = 0
                          totalMarks = 0
                          marks = acceptMarks()
                          print("Marks entered:", marks)
                          while option != 3:
                              print("\nMenu:")
                              print("1. Calculate total marks and percentage")
                              print("2. Find grade")
                              print("3. Exit")
                              option = int(input("Enter your choice (1-4): "))

                              if option == 1:
                                  totalMarks = sum(marks)
                                  percentage = computePercentage(totalMarks)
                                  print(f"Total Marks: {totalMarks}")
                                  print(f"Percentage: {percentage}%")
                              elif option == 2:
                                  if totalMarks == 0:
                                      print("Please enter marks first.")
                                  else:
                                      grade = findGrade(percentage)
                                      print(f"Grade: {grade}")
                              elif option == 3:
                                  print("Exiting the program.")

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

                      main()







                                                               Answers

                   Multiple Choice Questions
                   1. (a)     2. (c)     3. (c)      4. (c)     5. (b)     6. (c)      7. (b)     8. (a)     9. (b)
                   True or False
                   1. (F)     2. (T)     3. (F)      4. (F)     5. (T)     6. (T)
                   Fill in the blanks
                   1. else              2. control            3. break             4. outer, inner
                   5. endless / infinite   6. pass


                                                                                                   Looping in Python  333
   342   343   344   345   346   347   348   349   350   351   352