 # Python Program to add marks and calculate the grade of a student

In this simple python program, we have to find the grade of a student. It's a student-level python program.

To understand this example, you should have knowledge of the following Python programming topics:

## How to find the grade of a student in python?

Adding the marks of a subject and display the grade of a student is a common python program. It's a beginner-level program as we need to input the marks of each subject of the student. We calculate the average of the subjects' marks by taking the sum of the marks of the subjects and dividing the sum by the total number of subjects using python methods and basics.

From the marks' average, we calculate the grade using `if` condition and the `elif` in python to print, grades depend on the average of marks.

For example, let us take a case of students who got marks as 8, 7, 9, 6, 8 out of 10. The average of the marks is 7.6, and then we calculate the grade. A or B or C or D or F depends on numbers 9, 8, 7, 6, and 5. So here, the grade is C.

### ALGORITHM

STEP 1: Accept the marks of each subject separately from the user using the input method. Then Convert that string to integer using `int()` in a python programming language.

STEP 2: Calculate the average as the sum of the marks and divide the total by the number of subjects.

STEP 3: Use the `if` condition to check the grade using the value from the average. If the average is above 90 then print A.

STEP 4: Use `elif` statements in python language to print the grades from B, C, D, depending on the average marks like 80, 70, 60.

STEP 5: Use the `else` condition to print grade F if the value is less than 50.

## Python Source Code

```                                          ```sub1=int(input("Enter marks of the first subject: "))

sub2=int(input("Enter marks of the second subject: "))

sub3=int(input("Enter marks of the third subject: "))

sub4=int(input("Enter marks of the fourth subject: "))

sub5=int(input("Enter marks of the fifth subject: "))

average=(sub1+sub2+sub3+sub4+sub4)/5

if average >= 90:
elif average >= 80 and average < 90:
elif average >= 70 and average < 80:
elif average >= 60 and average < 70:
else:
```
```

## OUTPUT

```Enter marks of the first subject:  80

Enter marks of the second subject: 70

Enter marks of the third subject:  90

Enter marks of the fourth subject: 60

Enter marks of the fifth subject: 74 