Python Condition ,12.Write a Python program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer. Calculate percentage and grade according to following:
12.Write a Python program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer.
Calculate percentage and grade according to following:
Percentage >= 90% : Grade A
Percentage >= 80% : Grade B
Percentage >= 70% : Grade C
Percentage >= 60% : Grade D
Percentage >= 40% : Grade E
Percentage < 40% : Grade F
Solution :-
phy =int(input("Enter the marks of Physics :-"))
che =int(input("Enter the marks of Chemistry :-"))
bio =int(input("Enter the marks of Biology :-"))
maths =int(input("Enter the marks of Mathematics :-"))
comp =int(input("Enter the marks of Computer :-"))
tot = phy+che+bio+maths+comp
perc = tot//5
print("Total Marks is :-",tot)
print("Percentage is :-",perc)
if(perc >=90):
print("Your Grade is A")
elif(perc >=80):
print("Your Grade is B")
elif(perc >=70):
print("Your Grade is C")
elif(perc >=60):
print("Your Grade is D")
elif(perc >=40):
print("Your Grade is E")
elif(perc < 40):
print("Your Grade is F")
else:
print("Try again")
Output :-