1
0
Fork 0
advent-of-code/2015/aoc_d1p2.py

21 lines
303 B
Python
Raw Normal View History

2024-02-08 09:55:40 +01:00
#!/usr/bin/env python
floor = 0
pos = 0
basement_pos = 0
with open("inputd1.txt", "r") as f:
for input in f:
for c in input:
pos += 1
if c == "(":
floor += 1
elif c == ")":
floor -= 1
if floor < 0 and basement_pos == 0:
basement_pos = pos
print(floor)
print(basement_pos)