Python Program to Calculate Grade of Student

Python Program to Calculate Grade of Student

  • To calculate grade of students in python, you have to ask from user to enter marks obtained in 5 subjects and calculate the sum of all the marks and then calculate the average marks to find the grade according to the average marks obtained by student.

Source Code:

Python = float(input(" Please enter Python Marks: "))
Java = float(input(" Please enter Java score: "))
HTML = float(input(" Please enter HTML Marks: "))
C = float(input(" Please enter C Marks: "))
Ruby = float(input(" Please enter Ruby Marks: "))
total = Python + Java + HTML + C + Ruby
percentage = (total / 500) * 100
print("Total Marks = %.2f"  %total)
print("Marks Percentage = %.2f"  %percentage)
if(percentage >= 90):
    print("A Grade")
elif(percentage >= 80):
    print("B Grade")
elif(percentage >= 70):
    print("C Grade")
elif(percentage >= 60):
    print("D Grade")
elif(percentage >= 40):
    print("E Grade")
else:
    print("Fail")




Comments