Following is a program to read the Student’s Mark out of 100 obtained in 4 subjects and appropriate grade considering the following scheme.
- Grade = X if the mark is greater than or equal to 90
- Grade = A if the mark is between 80 and 89
- Grade = B if the mark is between 70 and 79
- Grade =C if the mark is between 60 and 69
- Grade = D if the mark is between 50 and 59
- Grade = P if the mark is between 35 and 49.
- Else the grade is F
Python program to READ the mark out of 100
subject1 = float(input("Enter marks for 1st subject (out of 100): "))
subject2 = float(input("Enter marks for 2nd subject (out of 100): "))
subject3 = float(input("Enter marks for 3rd subject (out of 100): "))
subject4 = float(input("Enter marks for 4th subject (out of 100): "))
average_marks = (subject1 + subject2 + subject3 + subject4) / 4
if average_marks >= 90:
grade = "X"
elif average_marks >= 80 and average_marks < 90:
grade = "A"
elif average_marks >= 70 and average_marks < 80:
grade = "B"
elif average_marks >= 60 and average_marks < 70:
grade = "C"
elif average_marks >= 50 and average_marks < 60:
grade = "D"
elif average_marks >= 35 and average_marks < 50:
grade = "P"
else:
grade = "F"
print(f"Average marks: {average_marks}")
print(f"Grade: {grade}")

