English

Write a program to find the grade of a student when grades are allocated as given in the table below. Percentage of Marks Grade Above 90% A 80% to 90% B 70% to 80% C 60% to 70% D Below 60% E - Computer Science (Python)

Advertisements
Advertisements

Question

Write a program to find the grade of a student when grades are allocated as given in the table below.

Percentage of Marks  Grade
Above 90% A
80% to 90% B
70% to 80% C
60% to 70% D
Below 60% E

The percentage of the marks obtained by the student is input into the program.

Short Note

Solution

Program:
#Program to print the grade of the student
n = float(input('Enter the percentage of the student: '))

if(n > 90):
    print("Grade A")
elif(n > 80):
    print("Grade B")
elif(n > 70):
    print("Grade C")
elif(n >= 60):
    print("Grade D")
else:
    print("Grade E")

OUTPUT:
Enter the percentage of the number: 60
Grade D
shaalaa.com
Introduction to Flow of Control - Selection
  Is there an error in this question or solution?
Chapter 6: Flow of Control - Exercise [Page 141]

APPEARS IN

NCERT Computer Science [English] Class 11
Chapter 6 Flow of Control
Exercise | Q 10. | Page 141
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×