sec_2.py (621B)
1 # WAP (Write a Program) to calculate total marks, percentage and grade of a student. Marks obtained in each of the three subjects are to be input by the user. 2 3 name = input("Enter the name: ") 4 print("Enter the marks: \n") 5 total = 0 6 for i in range(5): 7 total +=float(input(f"Subject {i}: ")) 8 p = total / 5 9 if p >= 90: 10 g = 'A+' 11 elif p >= 80: 12 g = 'A' 13 elif p >= 70: 14 g = 'B' 15 elif p >= 60: 16 g = 'C' 17 elif p >= 50: 18 g = 'D' 19 else: 20 g = 'Fail' 21 22 print("\n--- Student Report ---") 23 print("Student Name:", name) 24 print("Total Marks:", total, "/ 500") 25 print("Percentage:", round(p, 3), "%") 26 print("Grade:", g)