Skip to content

Commit 247c0a2

Browse files
authored
ibrahem reda elgamal
1 parent b1ea3af commit 247c0a2

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

ibrahem reda elgamal.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
def insert_student_score(categories, score):
2+
key = score
3+
i = len(categories) - 1
4+
5+
while i >= 0 and categories[i] > key:
6+
i -= 1
7+
8+
categories.insert(i + 1, key)
9+
10+
grades_A = []
11+
grades_B = []
12+
grades_C = []
13+
grades_D = []
14+
grades_F = []
15+
16+
scores = [85, 92, 58, 76, 99, 65, 45, 70, 80, 88]
17+
18+
for score in scores:
19+
if score >= 90:
20+
insert_student_score(grades_A, score)
21+
elif score >= 80:
22+
insert_student_score(grades_B, score)
23+
elif score >= 70:
24+
insert_student_score(grades_C, score)
25+
elif score >= 60:
26+
insert_student_score(grades_D, score)
27+
else:
28+
insert_student_score(grades_F, score)
29+
30+
print("الطلاب في الفئة A:", grades_A)
31+
print("الطلاب في الفئة B:", grades_B)
32+
print("الطلاب في الفئة C:", grades_C)
33+
print("الطلاب في الفئة D:", grades_D)
34+
print("الطلاب في الفئة F:", grades_F)

0 commit comments

Comments
 (0)