0 votes
107 views
in Python by (98.9k points)
edited

The marks obtained by a student in 3 different subjects are input by the user. Your program should calculate the average of subjects and display the grade. The student gets a grade as per the following rules:

  1. Average        Grade

  2. 90-100        A

  3. 80-89        B

  4. 70-79        C

  5. 60-69        D

  6. 0-59        F

1 Answer

0 votes
by (98.9k points)
selected by
 
Best answer
# Grade calculator

print("Enter the marks you recieved in three subjects")
max = int(input("maximum marks in Every Subject"))

mks1 = int(input("Enter marks in Subject 1 "))

mks2 = int(input("Enter marks in Subject 2 "))

mks3 = int(input("Enter marks in Subject "))

total = ((mks1+mks2+mks3))


ptg = total*100/(3*max)

print("Your percentage ",ptg)

if 90 < ptg <= 100:
 print("Grade is A")

elif 80 < ptg <= 89:

 print("Grade is B")

elif 70 < ptg <= 79 :

 print("Grade is C")

elif 60 < ptg <= 69:

 print("Grade is D")

elif 0 < ptg <= 59:

 print("Grade is F")

Related questions

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

557 users

...