Skip to content

Commit d837608

Browse files
committed
Reduce a nesting depth in mission 30
1 parent 745abe3 commit d837608

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/30-yankeedoodle.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from auth import read_riddle
1515
from etc import factorize
1616
from itertools import chain
17+
from itertools import product
1718

1819

1920
def read_csv_cells(url):
@@ -27,10 +28,9 @@ def extract_formula(cells, width, height):
2728
"""Extracts the formula hidden in the CSV"""
2829
it = iter(cells)
2930
formula = [[" "] * width for _ in range(height)]
30-
for x in range(width):
31-
for y in range(height):
32-
if float(next(it)) < round(1 - height / width, 1):
33-
formula[y][x] = "#"
31+
for x, y in product(range(width), range(height)):
32+
if float(next(it)) < round(1 - height / width, 1):
33+
formula[y][x] = "#"
3434
return formula
3535

3636

0 commit comments

Comments
 (0)