-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path18.py
More file actions
39 lines (31 loc) · 1.31 KB
/
18.py
File metadata and controls
39 lines (31 loc) · 1.31 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
Program No. : 18
Program : Calculate aggregate of student marks.
def calculate_student_performance():
print("--- Student Aggregate & Percentage Calculator ---")
try:
# 1. Input marks for 5 subjects
# Assuming maximum marks for each subject is 100
s1 = float(input("Enter marks for Mathematics: "))
s2 = float(input("Enter marks for Physics: "))
s3 = float(input("Enter marks for Chemistry: "))
s4 = float(input("Enter marks for English: "))
s5 = float(input("Enter marks for Computer Science: "))
# 2. Calculate Aggregate (Total Marks)
aggregate = s1 + s2 + s3 + s4 + s5
# 3. Calculate Percentage
# (Total obtained / Total maximum marks) * 100
# Total maximum marks = 500 (100 * 5)
percentage = (aggregate / 500) * 100
# 4. Display the results
print("\n--- Performance Report ---")
print(f"Total Marks (Aggregate): **{aggregate:.2f} / 500.00**")
print(f"Percentage: **{percentage:.2f}%**")
# Basic Result Status
if percentage >= 40:
print("Status: PASSED")
else:
print("Status: FAILED")
except ValueError:
print("Error: Please enter valid numeric marks.")
# Run the program
calculate_student_performance()