[Python/2015] Move solutions into .py files

This commit is contained in:
Felix Bargfeldt 2023-10-29 12:17:37 +01:00
parent 8c2be5fb77
commit 94dd3ae399
Signed by: Defelo
GPG key ID: 2A05272471204DD3
52 changed files with 996 additions and 3314 deletions

18
Python/2015/03.py Normal file
View file

@ -0,0 +1,18 @@
from lib import *
input = read_input(2015, 3)
def get_houses(instructions):
houses = [(x := 0, y := 0)]
for c in instructions:
x += c == ">"
x -= c == "<"
y += c == "v"
y -= c == "^"
houses.append((x, y))
return houses
print(len(set(get_houses(input))))
print(len(set(get_houses(input[::2])) | set(get_houses(input[1::2]))))