Ask Question

Write a program that prints the Grade based on the given data. 95-100: A + 90-94: A 80-89: B + 70-79: B 60-69: C + 50-59: C <49 : F Input: 50 | Output: C python

+4
Answers (1)
  1. 3 April, 19:16
    0
    The program to this question as follows:

    Program:

    score=int (input ("Enter your percentage: ")) #input grade by user

    #using conditional statement for match condition

    if 95<=score < = 100: #if value in between 95 to 100

    grade = 'A+' #assign grade

    elif 90 <=score < = 94: #elif value in between 90 to 94

    grade = 'A' #assign grade

    elif 80 <=score < = 89: #elif value in between 80 to 89

    grade = 'B+' #assign grade

    elif 70 <=score < = 79: #elif value in between 70 to 79

    grade = 'B' #assign grade

    elif 60 <=score < = 69: #elif value in between 60 to 69

    grade = 'C+' #assign grade

    elif 50 <=score < = 59: #elif value in between 50 to 59

    grade = 'C' #assign grade

    elif score<49 : #elif value is less then 49

    grade = 'F' #assign grade

    print (grade) #print grade

    Output:

    Enter your percentage: 50

    C

    Explanation:

    In the above python code, a variable "score" is defined, this variable is used for taking value from the user end. In the next step if-elif-else conditional statement is used, this statement is used when a group of statements is given in which one is true. The if block check score value is between 95-100 if this is true it will print A+.

    In elif block if the above condition is not true, then this condition will execute, in this block, there are multiple elif block is used that can be described as follows:

    In the first block, if the value in between 90-94. It will print A. In the second block, if the value in between 80-89. It will print B+. In the third block, if value in between 70-79. It will print B. In the fourth block, if value in between 60-69. It will print C+. In the fifth block, if value in between 50-59. It will print C. In the last, if the value of the score is less then 49. It will print F.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a program that prints the Grade based on the given data. 95-100: A + 90-94: A 80-89: B + 70-79: B 60-69: C + 50-59: C ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers