Python Online Compiler
Example: Python Program to Calculate Total Marks Percentage and Grade of a Student
C
C++
C#
Java
Python
PHP
main.py
STDIN
Run
# Python Program to Calculate Total Marks Percentage and Grade of a Student print("Enter the marks of five subjects::") subject_1 = float (input ()) subject_2 = float (input ()) subject_3 = float (input ()) subject_4 = float (input ()) subject_5 = float (input ()) total, average, percentage, grade = None, None, None, None # It will calculate the Total, Average and Percentage total = subject_1 + subject_2 + subject_3 + subject_4 + subject_5 average = total / 5.0 percentage = (total / 500.0) * 100 if average >= 90: grade = 'A' elif average >= 80 and average < 90: grade = 'B' elif average >= 70 and average < 80: grade = 'C' elif average >= 60 and average < 70: grade = 'D' else: grade = 'E' # It will produce the final output print ("\nThe Total marks is: \t", total, "/ 500.00") print ("\nThe Average marks is: \t", average) print ("\nThe Percentage is: \t", percentage, "%") print ("\nThe Grade is: \t", grade)
98 92 87 82 75
Output
Clear
ADVERTISEMENTS