Student Percentage Division Program in Python


The marks obtained by a student in 5 different subjects are input through the keyboard. The student gets a division as per the following rules: Write a program to calculate the division obtained by the student.

  1. Percentage above or equal to 60 - First division
  2. Percentage between 50 and 59 - Second division
  3. Percentage between 40 and 49 - Third division
  4. Percentage less than 40 – Fail

This program is a simple Python program that calculates the total marks and percentage of a student in 5 subjects.

  • The program first takes input from the user for the marks scored in each subject using the input() function and assigns the values to variables m1, m2, m3, m4, and m5 respectively. It then calculates the total marks by adding the values of all the variables and assigns the result to the variable 'total'. The percentage is calculated by dividing the total marks with 5, which is the total number of subjects.
  • The program then uses an if-else statement to check the percentage and print the division of the student based on the percentage. If the percentage is greater than or equal to 60, the program prints "First Division", if the percentage is greater than or equal to 50 and less than or equal to 59, it prints "Second Division", if the percentage is greater than or equal to 40 and less than or equal to 49, it prints "Third Division", otherwise it prints "Fail."

In summary, the program uses input function, arithmetic operator, if-else statement and comparison operator to calculate and determine the student's division based on the marks scored in 5 subjects.


Source Code

m1=int(input("Enter the Mark Subject 1 :"))
m2=int(input("Enter the Mark Subject 2 :"))
m3=int(input("Enter the Mark Subject 3 :"))
m4=int(input("Enter the Mark Subject 4 :"))
m5=int(input("Enter the Mark Subject 5 :"))
total=m1+m2+m3+m4+m5
per=total/5
print("Total :",total)
print("Percentage :",per)
if(per>=60):
	print("First Division..")
elif(per>=50 and per<=59):
	print("Second Division..")
elif(per>=40 and per<=49):
	print("Third Division..")
else:
	print("Fail..")

Output

Enter the Mark Subject 1 :91
Enter the Mark Subject 2 :56
Enter the Mark Subject 3 :88
Enter the Mark Subject 4 :89
Enter the Mark Subject 5 :97
Total : 421
Percentage : 84.2
First Division..


Example Programs