la façon de calculer le pourcentage en python

C'est mon programme

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

Résultat

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

Toutefois, le pourcentage résultat est 0. Comment dois-je calculer le pourcentage correctement en Python?

sans rapport: si vous avez une fraction puis de l'imprimer comme des pourcentages: print "{:.0%}".format(sum(marks) / (len(marks) * perfect_mark * 1.0))

OriginalL'auteur Jothimani | 2014-03-04