1. 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:-
rno = 5 name = “abc” physics = 95 chemistry = 93 biology = 96 mathematics= 89 computer = 89 tot = physics + chemistry + biology + mathematics + computer perc = tot//5 print(“Your roll no is :- “,rno) print(“Your name is :-“,name) print(“The total marks you gained :- “,tot) print(“Your Grade is :- “,perc) if perc >=90: print(“Grade A”) elif perc >=80: print(“Grade B”) elif perc>=70: print(“Grade C”) elif perc>=60: prit(“Grade D”) elif perc>=40: print(“Grade E”) else: print(“Grade F”)
Output :-
Solution :-
Dynamic
rno = int(input(“Enter the roll no :-“))
name = input(“Enter your name :-“)
physics = int(input(“Enter the marks of physics :-“))
chemistry = int(input(“Enter the marks of Chemistry :-“))
biology = int(input(“Enter the marks of Biology :-“))
mathematics= int(input(“Enter the marks of Maths :-“))
computer = int(input(“Enter the marks of Computer :-“))