We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6958751 commit 225d360Copy full SHA for 225d360
day02/main.py
@@ -18,6 +18,8 @@ def command_to_tuple(s: str) -> Tuple[str, int]:
18
down_commands = [c[1] if c[0] == "down" else 0 for c in commands]
19
20
print(sum(forward_commands) * (sum(down_commands) - sum(up_commands)))
21
+
22
+#part 2
23
aim_increments = [down - up for (down,up) in zip(down_commands, up_commands)]
24
aims = itertools.accumulate(aim_increments, operator.add)
25
0 commit comments