Advent-of-Code/2015/day 3/P1/delivering.py

18 lines
319 B
Python
Raw Permalink Normal View History

2019-12-01 17:44:00 +01:00
instructions = open("input.txt").read()
x = 0
y = 0
house = ["0;0"]
delivery = 0
for i in list(instructions):
if i == "^":
y+=1
elif i == "v":
y-=1
elif i == ">":
x+=1
elif i == "<":
x-=1
if f"{x};{y}" not in house:
house.append(f"{x};{y}")
print(len(house))