Dremendo Tag Line

Calculate total marks and percentage in Python

input() - Question 18

In this question, we will see how to input marks obtained in 5 different subjects in Python programming using the input() function and find out the total marks and percentage obtained. To know more about input() function click on the input() function lesson.

Q18) Write a program in Python to input marks obtained in 5 different subjects and find out the total marks and percentage obtained by the student. Assume that the maximum mark in each subject is 100.

Program

e=int(input('English '))
m=int(input('Maths '))
h=int(input('History '))
g=int(input('Geography '))
c=int(input('Computer '))
total=e+m+h+g+c
per=(total/500.0)*100
print('Total Marks={}'.format(total))
print('Percentage={:.2f}'.format(per))

Output

English 75
Maths 62
History 84
Geography 77
Computer 91
Total Marks=389
Percentage=77.80
video-poster