@@ -8,42 +8,66 @@ def students_list( Name, Roll_Number,School="GHSS SOGAM" , Class="11th", **Marks
88 "marks" : {subject : int (mark ) for subject , mark in Marks .items ()}
99 }
1010students = [
11- students_list ("Alice" , 101 , Math = 85 , English = 90 , Science = 78 , History = 88 , Geography = 92 ),
12- students_list ("Bob" , 102 , Math = 75 , English = 80 , Science = 70 , History = 65 , Geography = 72 ),
13- students_list ("Charlie" , 103 , Math = 95 , English = 92 , Science = 88 , History = 90 , Geography = 94 ),
14- students_list ("David" , 104 , Math = 60 , English = 65 , Science = 55 , History = 58 , Geography = 62 ),
15- students_list ("Eve" , 105 , Math = 82 , English = 88 , Science = 80 , History = 85 , Geography = 90 ),
16- students_list ("Frank" , 106 , Math = 45 , English = 50 , Science = 40 , History = 42 , Geography = 48 ),
17- students_list ("Grace" , 107 , Math = 70 , English = 75 , Science = 65 , History = 68 , Geography = 72 ),
18- students_list ("Henry" , 108 , Math = 55 , English = 60 , Science = 50 , History = 52 , Geography = 58 ),
19- students_list ("jacky" , 109 , Math = 95 , English = 60 , Science = 60 , History = 58 , Geography = 68 ),
20- students_list ("Henry" , 110 , Math = 65 , English = 60 , Science = 70 , History = 59 , Geography = 78 ),
21- students_list ("Henry" , 111 , Math = 85 , English = 60 , Science = 80 , History = 55 , Geography = 88 ),
11+ students_list ("Alice" , 101 , Math = 85 , English = 90 , Physics = 78 , Chemistry = 88 , Biology = 92 ),
12+ students_list ("Bob" , 102 , Math = 75 , English = 80 , Physics = 70 , Chemistry = 65 , Biology = 72 ),
13+ students_list ("Charlie" , 103 , Math = 95 , English = 92 , Physics = 88 , Chemistry = 90 , Biology = 94 ),
14+ students_list ("David" , 104 , Math = 60 , English = 65 , Physics = 55 , Chemistry = 58 , Biology = 62 ),
15+ students_list ("Eve" , 105 , Math = 82 , English = 88 , Physics = 80 , Chemistry = 85 , Biology = 90 ),
16+ students_list ("Frank" , 106 , Math = 45 , English = 50 , Physics = 40 , Chemistry = 42 , Biology = 48 ),
17+ students_list ("Grace" , 107 , Math = 70 , English = 75 , Physics = 65 , Chemistry = 68 , Biology = 72 ),
18+ students_list ("Henry" , 108 , Math = 55 , English = 60 , Physics = 50 , Chemistry = 52 , Biology = 58 ),
19+ students_list ("jacky" , 109 , Math = 95 , English = 60 , Physics = 60 , Chemistry = 58 , Biology = 68 ),
20+ students_list ("Henry" , 110 , Math = 65 , English = 60 , Physics = 70 , Chemistry = 59 , Biology = 78 ),
21+ students_list ("Henry" , 111 , Math = 85 , English = 60 , Physics = 80 , Chemistry = 55 , Biology = 88 ),
22+ students_list ("Henry" , 112 , Math = 85 , English = 60 , Science = 80 , History = 55 , Geography = 88 ),
23+ students_list ("Henry" , 113 , Math = 85 , English = 60 , Science = 80 , History = 55 , Geography = 88 ),
24+ students_list ("Mogli" , 114 , Math = 45 , English = 30 , Science = 40 , History = 35 , Geography = 28 ),
25+ students_list ("Mooz" , 115 , Math = 25 , English = 30 , Science = 39 , History = 35 , Geography = 28 ),
2226
2327
2428]
2529
2630def print_student_result (student ):
31+ failed_subjects = [subject for subject , mark in student ['marks' ].items () if int (mark ) < 40 ]
2732 total_marks = sum (int (mark ) for mark in student ["marks" ].values ())
2833 average_marks = total_marks / len (student ["marks" ])
29- print (f"School Name:{ student [" school" ]} " )
30- print (f"Student: { student [" name" ]} " )
31- print (f"Roll Number :{ student [" roll_number" ]} " )
34+ print (f"School Name:{ student [' school' ]} " )
35+ print (f"Student: { student [' name' ]} " )
36+ print (f"Roll Number :{ student [' roll_number' ]} " )
3237 print (f"Class: { student ['class' ]} " )
33- print (f"Marks: { student ['marks' ]} " )
34- print (f"Total Marks: { total_marks } out of { len (student ['marks' ]) * 100 } " )
38+
39+ if len (failed_subjects ) >= 1 and len (failed_subjects ) < 5 :
40+ print ("Overall Result: Re-appear" )
41+ print (f"Failed Subjects: { ', ' .join (failed_subjects )} with marks: { ', ' .join (str (student ['marks' ][subject ]) for subject in failed_subjects )} respectively" )
42+ return
43+
44+ elif len (failed_subjects ) == 5 :
45+ print ("Overall Result: Failed" )
46+ print (f"Failed Subjects: { ', ' .join (failed_subjects )} with marks: { ', ' .join (str (student ['marks' ][subject ]) for subject in failed_subjects )} respectively" )
47+ return
48+ else :
49+ print ("Subject-wise Results:" )
50+ for subject , mark in student ['marks' ].items ():
51+ if int (mark ) >= 40 :
52+ print (f" { subject } : ({ mark } ) Passed" )
53+ else :
54+ print (f" { subject } : ({ mark } ) Failed" )
55+
56+ #print(f"Marks:{student['marks']}") Note: alternative to print subject-wise results
57+ print (f"Total Marks Obetained : { total_marks } out of { len (student ['marks' ]) * 100 } " )
3558 print (f"Marks Percentage: { average_marks :.2f} %" )
59+ # add grading system
60+
3661 if average_marks >= 90 :
37- print ("Result: Passed with Distinction" )
62+ print ("Result: Passed with Distinction" )
3863 elif average_marks >= 60 and average_marks < 90 :
39- print ("Result: Passed with First Class" )
64+ print ("Result: Passed with First Class" )
4065 elif average_marks >= 50 and average_marks < 60 :
41- print ("Result: Passed with Second Class" )
42- elif average_marks >= 40 and average_marks < 50 :
43- print ("Result: Passed with Third Class" )
66+ print ("Result: Passed with Second Class" )
4467 else :
45- print ("Result: Failed" )
46- print ("-" * 40 )
68+ print ("Result: Passed with Third Class" )
69+
70+
4771
4872def find_student_by_roll (roll_number ):
4973 for student in students :
0 commit comments