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 Percentage of the marks obtained by the student is input to the program.
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 |
Percentage of the marks obtained by the student is input to the program.
✨ Free AI Tools for You
Powered by Chatterbot AI
Answer
Below is a Python program to find the grade of a student based on the percentage of marks obtained:
# Program to find the grade of a student based on percentage of marks
# Input: Percentage of marks obtained by the student
percentage = float(input("Enter the percentage of marks obtained: "))
# Determine the grade based on the given criteria
if percentage > 90:
grade = "A"
elif percentage >= 80:
grade = "B"
elif percentage >= 70:
grade = "C"
elif percentage >= 60:
grade = "D"
else:
grade = "E"
# Output: Display the grade
print(f"The grade of the student is: {grade}")
Explanation:
The program takes the percentage of marks obtained as input from the user.
It then compares the percentage against the given criteria using an if-elif-else chain to determine the appropriate grade.
Finally, it prints the grade of the student.
India's 1st AI Doubt Solver for CBSE, JEE, and NEET
Ask a Question for Freeand then it's just ₹212 a month