mirror of
https://github.com/Crocmagnon/advent-of-code.git
synced 2024-11-22 06:28:11 +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:
|
def solve_part_2(data: list[str]) -> int:
|
||||||
total = 0
|
total = 0
|
||||||
for chunk in chunks(data, 3):
|
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
|
total += string.ascii_letters.index(common_letter) + 1
|
||||||
return total
|
return total
|
||||||
|
|
||||||
|
@ -52,6 +54,7 @@ def chunks(data, size):
|
||||||
for i in range(0, len(data), size):
|
for i in range(0, len(data), size):
|
||||||
yield data[i : i + size]
|
yield data[i : i + size]
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main("inputs/day03-test1", expected_part_1=157, expected_part_2=70)
|
main("inputs/day03-test1", expected_part_1=157, expected_part_2=70)
|
||||||
main("inputs/day03", expected_part_1=7716, expected_part_2=2973)
|
main("inputs/day03", expected_part_1=7716, expected_part_2=2973)
|
||||||
|
|
Loading…
Reference in a new issue