From 7ccf765434a92ac5b59b8fa85dc701e3572d9b21 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Fri, 3 Dec 2021 15:13:42 +0000 Subject: day 3 part 1: remove superfluous nbits variable --- 3.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/3.py b/3.py index b61cda1..7c81495 100644 --- a/3.py +++ b/3.py @@ -15,8 +15,7 @@ def bits_to_int(bits: Bits) -> int: return sum(b * 2 ** i for i, b in enumerate(reversed(bits))) def part1(nums: Input) -> int: - nbits: int = len(nums[0]) - gamma: Bits = tuple(most_common(inp, i) for i in range(nbits)) + gamma: Bits = tuple(most_common(inp, i) for i in range(len(nums[0]))) epsilon: Bits = tuple(not bit for bit in gamma) return bits_to_int(gamma) * bits_to_int(epsilon) -- cgit v1.2.3-54-g00ecf