Saturday, 21 September 2024

Practical - 72 - Write a Python program that accepts the roll number and marks of the student in two subjects and displays the grade of the student

Practical - 72 - Write a Python program that accepts the roll number and marks of the student in two subjects and displays the grade of the student as per the following criteria

Percentage>60 : Grade A,

Percentage<=60 and Percentage>=33: Grade B

Percentage<33: Reappear 


Ans:

rn=int(input("Enter the roll number of student: "))

marks1=int(input("Enter marks in Subject 1: "))

marks2=int(input("Enter marks in Subject 2: "))

total_marks=200

percentage=(marks1+marks2)*100/total_marks

print("Roll Number of student: ", rn)

if percentage > 60:

    print("Grade A")

elif 33 <= percentage <= 60:

    print("Grade B")

else:

    print("Reappear")

 

Output:

Enter the roll number of student: 1

Enter marks in Subject 1: 75

Enter marks in Subject 2: 82

Roll Number of student:  1

Grade A


OR


Enter the roll number of student: 2

Enter marks in Subject 1: 35

Enter marks in Subject 2: 46

Roll Number of student:  2

Grade B


OR


Enter the roll number of student: 3

Enter marks in Subject 1: 16

Enter marks in Subject 2: 28

Roll Number of student:  3

Reappear

No comments:

Post a Comment