Computer Science, asked by harshini110500, 11 months ago

A teacher in a school wants to find and display the grade of a student based on his/her percentage score. The criterion for grades is as given below: Score (both inclusive) Grade Between 80 and 100 A Between 73 and 79 B Between 65 and 72 C Between 0 and 64 D Any other value Z Assume that the percentage score is a whole number. Write a python program for the above requirement. Identify the test data and use it to test the program.

Answers

Answered by Anonymous
10

Answer:

Python Program:

scr=(input("Enter the Score: "))

try:

   scr=float(scr)

   if scr>=0.0 and scr<=1.0:

       if scr >= 0.9:

           print("A")

       elif scr >= 0.8:

           print("B")

       elif scr >= 0.7:

           print("C")

       elif scr >= 0.6:

           print("D")

       elif scr<0.6:

           print("F")

   else:

       print("Out Of range")

except:

   print("Try a number")

Explanation:

scr is the score which will take float as input ranging from 0.0 to 1.0. If the score is less than 0.0 or greater than 1.0 then it prints "Out of Range". If entered input is not float/ int then it will print "Try a Number".

Similar questions