Page 136 - TP_Pluse_V2.2_Class_7
P. 136

On running the above program, we get the following output:

                      Output

                   Enter the marks: 60
                   Passed with C grade


                   Enter the marks: 87
                   Passed with A grade


                   Enter the marks: 30
                   Sorry!!!, You failed the exam.


                   Enter the marks: 79
                   Passed with B grade





                   Program 9: A school wants to automate its grading system. The program should calculate a
                   student's grade based on their score. Use the following grading criteria:
                   1.   90 and above: A

                   2.   80-89: B
                   3.  70-79: C
                   4.  60-69: D
                   5.  Below 60: F



                      Program9.py
                   File  Edit  Format   Run    Options   Window    Help


                   score = int(input("Enter the student's score: "))
                   # Determine the grade based on the score
                   if score >= 90:
                       grade = 'A'
                   elif score >= 80:
                       grade = 'B'
                   elif score >= 70:
                       grade = 'C'
                   elif score >= 60:
                       grade = 'D'
                   else:
                       grade = 'F'
                   # Print the assigned grade
                   print("The student's grade is:",grade)





                  134   Plus (Ver. 2.2)-VII
   131   132   133   134   135   136   137   138   139   140   141