Skip to content

Commit 11247b9

Browse files
committed
Fix code style issues with Black
1 parent 5bc4530 commit 11247b9

File tree

4 files changed

+12
-20
lines changed

4 files changed

+12
-20
lines changed

2_intermediate/chapter10/practice/odd_sum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
#
88
# Write the code below.
99

10-
two_d_list = [[1,2,3,5,2],[2,3,1,4],[2,3,1,2,21],[21,3,1,41]]
11-
#two_d_list should print 51 after the program runs.
10+
two_d_list = [[1, 2, 3, 5, 2], [2, 3, 1, 4], [2, 3, 1, 2, 21], [21, 3, 1, 41]]
11+
# two_d_list should print 51 after the program runs.

2_intermediate/chapter10/practice/smooth_max.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# given the 2D list [[0,4][2,6]], the 1st element of each of the
44
# 1D list is considered "smooth" because 0 + 0 is 0 and 0 + 2 is 2
55
# (both are even numbers). Find the maximum "smooth" element and
6-
# print it. Using the example [[0,4][2,6]] again, the maximum
6+
# print it. Using the example [[0,4][2,6]] again, the maximum
77
# "smooth" element is 2 because 2 is bigger than 0.
88

9-
two_d_list = [[425,214,412,123],[312,214,123,343]]
10-
9+
two_d_list = [[425, 214, 412, 123], [312, 214, 123, 343]]

2_intermediate/chapter10/solutions/odd_sum.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,16 @@
77
#
88
# Write the code below.
99

10-
two_d_list = [[1,2,3,5,2],[2,3,1,4],[2,3,1,2,21],[21,3,1,41]]
11-
#two_d_list should print 51 after the program runs.
10+
two_d_list = [[1, 2, 3, 5, 2], [2, 3, 1, 4], [2, 3, 1, 2, 21], [21, 3, 1, 41]]
11+
# two_d_list should print 51 after the program runs.
1212

1313
odd_sum = 0
14-
for outer_idx in range(1,len(two_d_list),2):
15-
for inner_idx in range(1, len(two_d_list[outer_idx]),2):
14+
for outer_idx in range(1, len(two_d_list), 2):
15+
for inner_idx in range(1, len(two_d_list[outer_idx]), 2):
1616
odd_sum += two_d_list[outer_idx][inner_idx]
1717

1818
first_sum = 0
1919
for inner_list in range(len(two_d_list)):
2020
first_sum += two_d_list[inner_list][0]
2121

22-
print(odd_sum* first_sum )
23-
24-
25-
22+
print(odd_sum * first_sum)

2_intermediate/chapter10/solutions/smooth_max.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,18 @@
33
# given the 2D list [[0,4][2,6]], the 1st element of each of the
44
# 1D list is considered "smooth" because 0 + 0 is 0 and 0 + 2 is 2
55
# (both are even numbers). Find the maximum "smooth" element and
6-
# print it. Using the example [[0,4][2,6]] again, the maximum
6+
# print it. Using the example [[0,4][2,6]] again, the maximum
77
# "smooth" element is 2 because 2 is bigger than 0.
88

9-
two_d_list = [[425,214,412,123],[312,214,123,343]]
9+
two_d_list = [[425, 214, 412, 123], [312, 214, 123, 343]]
1010
curr_max = None
1111

1212
for outer_idx in range(len(two_d_list)):
1313
for inner_idx in range(len(two_d_list[outer_idx])):
1414
curr_elem = two_d_list[outer_idx][inner_idx]
1515
to_check = curr_elem + inner_idx
16-
if to_check % 2 == 0:
16+
if to_check % 2 == 0:
1717
if curr_max == None or curr_elem > curr_max:
1818
curr_max = curr_elem
1919

2020
print(curr_max)
21-
22-
23-
24-

0 commit comments

Comments
 (0)