Initial commit / Day 01 / Day 02

This commit is contained in:
Sebastian Seedorf
2021-12-02 11:43:40 +01:00
commit a35914003f
14 changed files with 3136 additions and 0 deletions

17
day02/part1.py Normal file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env python3
lines = (x.strip() for x in open("input.txt"))
hor = 0
depth = 0
for line in lines:
cmd, strVal = line.split(" ")
val = int(strVal)
if cmd == 'forward':
hor += val
elif cmd == 'down':
depth += val
else:
depth -= val
print(hor*depth)