Something went wrong. Try again.
My Advent of Code solutions in Python. kevinyap.ca/2019/12/going-fast-in-advent-of-code
advent-of-code python
Something went wrong. Try again.
123456789101112131415161718192021222324import fileinput
pos = 0aim = 0part_1_depth = 0part_2_depth = 0
for line in fileinput.input(): ins, num = line.split() num = int(num)
if ins == 'forward': pos += num part_2_depth += (aim * num) elif ins == 'down': part_1_depth += num aim += num elif ins == "up": part_1_depth -= num aim -= num
print "Part 1:", pos * part_1_depthprint "Part 2:", pos * part_2_depth