MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/3uyl7s/daily_programming_puzzles_at_advent_of_code/cxj007j/?context=3
r/programming • u/Aneurysm9 • Dec 01 '15
179 comments sorted by
View all comments
Show parent comment
1
Part 2 with enumerate:
level = 0 for position,step in enumerate(day1input, start=1): if step == '(': level += 1 else: level -= 1 if level == -1: print('basement first entered at position {}'.format(position)) break
View all comments
Show parent comment
1
u/sinjp Dec 01 '15
Part 2 with enumerate: