Python program to input marks and calculate the subject grade of a student

Write a python program to input marks and calculate the subject grade of a student.

In this program we will learn about if-else statement, function calling, map(), split() functions.

def findGrade():
    for m in Marks:
        if(m>90 and m<=100):
            print("O+")
        elif(m>80 and m<=90):
            print("O")
        elif(m>70 and m<=80):
            print("A+")
        elif(m>60 and m<=70):
            print("A")
        elif(m>50 and m<=60):
            print("B+")
        elif(m>40 and m<=50):
            print("B")
        elif(m<=40):
            print("F")
        
Marks = list(map(int,input("Enter Subject Marks: ").split()))
findGrade()

 

Output:

Enter Subject Marks: 98 78 56 42 35 89
O+
A+
B+
B
F
O

Leave a comment