From f85949f85266768ec1bd5e3d150e4ac71feabcf1 Mon Sep 17 00:00:00 2001 From: boredpasta Date: Mon, 13 Jan 2025 07:00:52 +0200 Subject: Add project files --- 2015/01/not_quite_lisp2.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 2015/01/not_quite_lisp2.py (limited to '2015/01/not_quite_lisp2.py') diff --git a/2015/01/not_quite_lisp2.py b/2015/01/not_quite_lisp2.py new file mode 100644 index 0000000..a688b3b --- /dev/null +++ b/2015/01/not_quite_lisp2.py @@ -0,0 +1,14 @@ +pos = 1 +floor = 0 +with open("input", encoding="utf-8") as f: + text = f.read() +for char in text: + if char == '(' or char == ')': + if char == '(': + floor += 1 + else: + floor -= 1 + if floor == -1: + print(f"basement position is {pos}") + break; + pos += 1 -- cgit v1.2.3