Student Mark Calculation in Python


If the marks obtained by a student in five different subjects are input through the keyboard, find out the aggregate marks and percentage marks obtained by the student. Assume that the maximum marks that can be obtained by a student in each subject is 100.

This program is a simple Python script that calculates the total marks and percentage of marks obtained by a student in 5 subjects. It prompts the user to input marks of 5 subjects, add all the marks, and calculates the percentage of marks obtained by the student.

The program first prompts the user to input marks of 5 subjects using the input() function and assigns them to the variables m1, m2, m3, m4, and m5 respectively. The int() function is used to convert the input from a string to an integer.

Next, the program calculates the total marks obtained by the student by adding the marks of all 5 subjects and assigns the value to the variable "total". It then calculates the percentage of marks obtained by the student by dividing the total marks by 5 and assigns the value to a variable "per"

Finally, the program uses the print() function to output the results, including the total marks obtained by the student and the percentage of marks obtained by the student.


Source Code

m1=int(input("Enter the marks 1:"))
m2=int(input("Enter the mark 2:"))
m3=int(input("Enter the mark 3:"))
m4=int(input("Enter the mark 4:"))
m5=int(input("Enter the mark 5:"))
total=m1+m2+m3+m4+m5
per=total/5
print("Total Marks:",total)
print("Percentage Marks:",per)

Output

Enter the marks 1:92
Enter the mark 2:56
Enter the mark 3:89
Enter the mark 4:97
Enter the mark 5:89
Total Marks: 423
Percentage Marks: 84.6


Example Programs