Skip to content

Commit 225d360

Browse files
author
Mladjo Milunovic
committed
separated parts
1 parent 6958751 commit 225d360

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

day02/main.py

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ def command_to_tuple(s: str) -> Tuple[str, int]:
1818
down_commands = [c[1] if c[0] == "down" else 0 for c in commands]
1919

2020
print(sum(forward_commands) * (sum(down_commands) - sum(up_commands)))
21+
22+
#part 2
2123
aim_increments = [down - up for (down,up) in zip(down_commands, up_commands)]
2224
aims = itertools.accumulate(aim_increments, operator.add)
2325

0 commit comments

Comments
 (0)