advent_of_code

advent of code solves
git clone https://git.pastanoggin.com/advent_of_code.git
Log | Files | Refs

not_quite_lisp2.py (327B)


      1 pos = 1
      2 floor = 0
      3 with open("input", encoding="utf-8") as f:
      4     text = f.read()
      5 for char in text:
      6     if char == '(' or char == ')':
      7         if char == '(':
      8             floor += 1
      9         else:
     10             floor -= 1
     11         if floor == -1:
     12             print(f"basement position is {pos}")
     13             break;
     14         pos += 1