Articles

Python program to calculate grade of student as per marks obtained

Python program to calculate grade of student as per marks obtained


In this python programming article, we are going to learn

  • python program to calculate grade of student

Grade program in python

Here we are going to write python program to find grade of a student based on the marks obtained by student. This code will use decision making statement if-ef-else concept in python.

 

Please check our video tutorial on python program to find grade of a student:

 

The python program to calculate grades is as follows:

 

# Owner : TutorialsInhand Author : Devjeet Roy

marks = float(input("Enter your marks in Computer Science: "))

if marks > 90:
    print("Grade: O")
elif marks >= 80 and marks < 90:
    print("Grade: A+")
elif marks >= 70 and marks < 80:
    print("Grade: A")
elif marks >= 60 and marks < 70:
    print("Grade: B+")
elif marks >= 50 and marks < 60:
    print("Grade: B")
elif marks >= 40 and marks < 50:
    print("Grade: C")
else:
    print("Grade: F")

The output of the grading system program in python is as follows:

 

PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter your marks in Computer Science: 78
Grade: A

Few important tips about this program

1. We take the user input marks and convert it to float data type.

2. Thereafter, we used a ladder like if-elif-else conditional statement to find the exact range within which the marks lies and prints the grade as per that.

 

Python program to calculate grade of student snapshot:

grading system program in python

Now you can manipulate the above code to write your own logic for grade program in python or grading system program in python. This wraps up our session on python program to find grade of a student.


Basic Python Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com

About the Author
Devjeet Roy
Full Stack Web Developer & Blockchain Enthusiast
Page Views :    Published Date : Nov 18,2022  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!