# Python Program to Calculate Grade of Student

## Calculate Grade of Student in Python

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 as shown in the program given below.

## Python Programming Code to Calculate Grade of Student

Following python program ask from user to enter marks obtained in 5 subjects to calculate the grade of student:

```# Python Program - Calculate Grade of Student

while True:
print("Enter 'x' for exit.")
print("Enter marks obtained in 5 subjects: ")
mark1 = int(input())
mark2 = int(input())
mark3 = int(input())
mark4 = int(input())
mark5 = int(input())
if mark1 == 'x':
break
else:
sum = mark1 + mark2 + mark3 + mark4 + mark5
average = sum/5
if(average>=91 and average<=100):
elif(average>=81 and average<=90):
elif(average>=71 and average<=80):
elif(average>=61 and average<=70):
elif(average>=51 and average<=60):
elif(average>=41 and average<=50):
elif(average>=0 and average<=40):
else:

Here are some sample runs of the above python program to demonstrate how to calculate the grade of student. This is the first snapshot:

This is the second snapshot:

Here is the third snapshot:

### Same Program in Other Languages

You may also like to learn or practice the same program in other popular programming languages:

Tools
Calculator