AdventOfCode/2015/day1/part2.py

21 lines
377 B
Python
Raw Normal View History

2023-12-04 15:21:31 +01:00
#!/bin/python3
import sys
from pprint import pprint
input_f = sys.argv[1]
result = 0
with open(input_f) as file:
for line in file:
for idx,i in enumerate(line):
if i == '(':
result += 1
if i == ')':
result -= 1
if result == -1:
print(idx+1)
break
print(result)