sec_2.py
Problem Statement
sec_2.py
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.
Source Code
python
# 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.
name = input("Enter the name: ")
print("Enter the marks: \n")
total = 0
for i in range(5):
total +=float(input(f"Subject {i}: "))
p = total / 5
if p >= 90:
g = 'A+'
elif p >= 80:
g = 'A'
elif p >= 70:
g = 'B'
elif p >= 60:
g = 'C'
elif p >= 50:
g = 'D'
else:
g = 'Fail'
print("\n--- Student Report ---")
print("Student Name:", name)
print("Total Marks:", total, "/ 500")
print("Percentage:", round(p, 3), "%")
print("Grade:", g)1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26