Write a python program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer. Calculate percentage and grade according to following:
SOLUTION....
# Program to calculate percentage and grade of 5 subjects
# Input marks
physics = float(input("Enter marks in Physics: "))
chemistry = float(input("Enter marks in Chemistry: "))
biology = float(input("Enter marks in Biology: "))
mathematics = float(input("Enter marks in Mathematics: "))
computer = float(input("Enter marks in Computer: "))
# Total and Percentage
total = physics + chemistry + biology + mathematics + computer
percentage = (total / 500) * 100 # assuming each subject is out of 100
# Determine grade
if percentage >= 90:
grade = "A"
elif percentage >= 80:
grade = "B"
elif percentage >= 70:
grade = "C"
elif percentage >= 60:
grade = "D"
elif percentage >= 40:
grade = "E"
else:
grade = "F"
# Output
print("Total Marks = ",total)
print("Percentage = ",percentage)
print("Grade = ",grade)
OUTPUT