Skip to content

Commit 19759bf

Browse files
committed
Fix code style issues with Black
1 parent cafb98c commit 19759bf

File tree

2 files changed

+77
-16
lines changed

2 files changed

+77
-16
lines changed

2_intermediate/chapter9/practice/participation_grade.py

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,48 @@
44
# name in the list is the number of times the student participated in this week.
55
# If a student has more the 7 participation, then got an A. If a student has
66
# more than 3 but less than 8, the student got a B. If a student has more than
7-
# 0 but less than 4, the student got a C.
7+
# 0 but less than 4, the student got a C.
88
#
99
# Make a dictionary with the keys as the students' name and the values as the
1010
# corresponding student's letter grade. Print the dictionary
1111
#
1212
# Write your code below
1313

1414

15-
participation_occurences = ["Sam", "Dan", "Bob", "Dan", "Sam", "Sam",
16-
"Bob", "Dan", "Dan", "Ivan", "Ivan",
17-
"Ray", "Sam", "Sam", "Dan", "Ivan", "Ivan",
18-
"Ray", "Dan", "Ivan", "Ivan", "Sam", "Dan",
19-
"Ray", "Sam", "Dan", "Bob", "Dan", "Sam",
20-
"Sam", "Dan", "Bob", "Dan", "Sam", "Sam"]
21-
15+
participation_occurences = [
16+
"Sam",
17+
"Dan",
18+
"Bob",
19+
"Dan",
20+
"Sam",
21+
"Sam",
22+
"Bob",
23+
"Dan",
24+
"Dan",
25+
"Ivan",
26+
"Ivan",
27+
"Ray",
28+
"Sam",
29+
"Sam",
30+
"Dan",
31+
"Ivan",
32+
"Ivan",
33+
"Ray",
34+
"Dan",
35+
"Ivan",
36+
"Ivan",
37+
"Sam",
38+
"Dan",
39+
"Ray",
40+
"Sam",
41+
"Dan",
42+
"Bob",
43+
"Dan",
44+
"Sam",
45+
"Sam",
46+
"Dan",
47+
"Bob",
48+
"Dan",
49+
"Sam",
50+
"Sam",
51+
]

2_intermediate/chapter9/solutions/participation_grade.py

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,51 @@
44
# name in the list is the number of times the student participated in this week.
55
# If a student has more the 7 participation, then got an A. If a student has
66
# more than 3 but less than 8, the student got a B. If a student has more than
7-
# 0 but less than 4, the student got a C.
7+
# 0 but less than 4, the student got a C.
88
#
99
# Make a dictionary with the keys as the students' name and the values as the
1010
# corresponding student's letter grade. Print the dictionary
1111
#
1212
# Write your code below
1313

1414

15-
participation_occurences = ["Sam", "Dan", "Bob", "Dan", "Sam", "Sam",
16-
"Bob", "Dan", "Dan", "Ivan", "Ivan",
17-
"Ray", "Sam", "Sam", "Dan", "Ivan", "Ivan",
18-
"Ray", "Dan", "Ivan", "Ivan", "Sam", "Dan",
19-
"Ray", "Sam", "Dan", "Bob", "Dan", "Sam",
20-
"Sam", "Dan", "Bob", "Dan", "Sam", "Sam"]
15+
participation_occurences = [
16+
"Sam",
17+
"Dan",
18+
"Bob",
19+
"Dan",
20+
"Sam",
21+
"Sam",
22+
"Bob",
23+
"Dan",
24+
"Dan",
25+
"Ivan",
26+
"Ivan",
27+
"Ray",
28+
"Sam",
29+
"Sam",
30+
"Dan",
31+
"Ivan",
32+
"Ivan",
33+
"Ray",
34+
"Dan",
35+
"Ivan",
36+
"Ivan",
37+
"Sam",
38+
"Dan",
39+
"Ray",
40+
"Sam",
41+
"Dan",
42+
"Bob",
43+
"Dan",
44+
"Sam",
45+
"Sam",
46+
"Dan",
47+
"Bob",
48+
"Dan",
49+
"Sam",
50+
"Sam",
51+
]
2152

2253
grade_dict = {}
2354
for student in participation_occurences:
@@ -29,7 +60,7 @@
2960
for student in grade_dict:
3061
if grade_dict[student] > 7:
3162
grade_dict[student] = "A"
32-
elif grade_dict[student] >3:
63+
elif grade_dict[student] > 3:
3364
grade_dict[student] = "B"
3465
else:
3566
grade_dict[student] = "C"

0 commit comments

Comments
 (0)