aboutsummaryrefslogtreecommitdiff
path: root/2020/16
diff options
context:
space:
mode:
authorThomas Voss <thomasvoss@live.com> 2021-12-08 15:31:49 +0100
committerThomas Voss <thomasvoss@live.com> 2021-12-08 15:31:49 +0100
commite806b43689f78c1d7f858d84c2c40b2ddcd67540 (patch)
treef153ec972ee91b8b586ba4092011df76bb0ebc08 /2020/16
parent0a082f129f9438fbfaf315ca3220e62586c878cd (diff)
Compress 5 lines into 1
Diffstat (limited to '2020/16')
-rwxr-xr-x2020/16/puzzle-1.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/2020/16/puzzle-1.py b/2020/16/puzzle-1.py
index 9f35856..c7cba37 100755
--- a/2020/16/puzzle-1.py
+++ b/2020/16/puzzle-1.py
@@ -14,14 +14,12 @@ def main() -> None:
valid.extend(range(bounds[0], bounds[1] + 1))
i += 1
- # Skip to nearby tickets
- i += 5
- acc = 0
-
- for j in range(i, len(data)):
- acc += sum(field for field in tuple(map(int, data[j].split(","))) if field not in valid)
-
- print(acc)
+ print(
+ sum(
+ sum(field for field in tuple(map(int, data[j].split(","))) if field not in valid)
+ for j in range(i + 5, len(data))
+ )
+ )
if __name__ == "__main__":