This is my program
print" Welcome to NLC Boys Hr. Sec. School "
a=input("\nEnter the Tamil marks :")
b=input("\nEnter the English marks :")
c=input("\nEnter the Maths marks :")
d=input("\nEnter the Science marks :")
e=input("\nEnter the Social science marks :")
tota=a+b+c+d+e
print"Total is: ", tota
per=float(tota)*(100/500)
print "Percentage is: ",per
Result
Welcome to NLC Boys Hr. Sec. School
Enter the Tamil marks :78
Enter the English marks :98
Enter the Maths marks :56
Enter the Science marks :65
Enter the Social science marks :78 Total is: 375 Percentage is: 0.0
However, the percentage result is 0
. How do I calculate the percentage correctly in Python?
print "{:.0%}".format(sum(marks) / (len(marks) * perfect_mark * 1.0))
– Shelving