Created
January 29, 2021 10:57
-
-
Save switowski/04cad4a277d26e831d6a2ae1a90f9ab4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [5]: %xmode | |
Exception reporting mode: Context | |
In [6]: solve() | |
--------------------------------------------------------------------------- | |
IndexError Traceback (most recent call last) | |
<ipython-input-8-6f300b4f5987> in <module> | |
----> 1 solve() | |
~/workspace/iac/solver.py in solve() | |
25 def solve(): | |
26 vals = getInput() | |
---> 27 sol_part1 = part1(vals) | |
28 print(f"Part 1: {sol_part1}") | |
29 print(f"Part 2: {part2(vals, sol_part1)}") | |
~/workspace/iac/solver.py in part1(vals) | |
14 | |
15 def part1(vals: list) -> int: | |
---> 16 return count_trees(vals, 3, 1) | |
17 | |
18 def part2(vals: list, sol_part1: int) -> int: | |
~/workspace/iac/solver.py in count_trees(vals, dx, dy) | |
9 x = (x + dx) % mod | |
10 y += dy | |
---> 11 if vals[y][x] == "#": | |
12 cnt += 1 | |
13 return cnt | |
IndexError: list index out of range |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment