mirror of
https://github.com/Crocmagnon/advent-of-code.git
synced 2024-11-21 22:18:12 +01:00
Fix black
This commit is contained in:
parent
b5a01d5afb
commit
c04ee4c040
1 changed files with 6 additions and 3 deletions
|
@ -43,7 +43,9 @@ def solve_part_1(data: DataType) -> int:
|
|||
def solve_part_2(data: list[str]) -> int:
|
||||
total = 0
|
||||
for chunk in chunks(data, 3):
|
||||
common_letter = set(chunk[0]).intersection(set(chunk[1])).intersection(set(chunk[2])).pop()
|
||||
common_letter = (
|
||||
set(chunk[0]).intersection(set(chunk[1])).intersection(set(chunk[2])).pop()
|
||||
)
|
||||
total += string.ascii_letters.index(common_letter) + 1
|
||||
return total
|
||||
|
||||
|
@ -52,6 +54,7 @@ def chunks(data, size):
|
|||
for i in range(0, len(data), size):
|
||||
yield data[i : i + size]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main("inputs/day03-test1", expected_part_1=157, expected_part_2=70)
|
||||
main("inputs/day03", expected_part_1=7716, expected_part_2=2973)
|
||||
|
|
Loading…
Reference in a new issue