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
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:
Now you can manipulate the above code to write your own logic for grade program in python or grading system program in python.
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 & Data Science Enthusiast
Page Views :
Published Date :
Aug 01,2021