i did part 1 with a re but for part 2 I was reading the file in chunks and checking if do or dont is in their and if not I would process the entire buffer but your solution is wayyyyy better Im going to practice more re expressions cause I overcomplicated things haha
no, it can not. If enabled is False, but it matched some numbers (e.g. ('1', '2', '')) then enabled = match[2] == "do()" will give False, and it will break the logic, you try to run with your version
i did part 1 with a re but for part 2 I was reading the file in chunks and checking if do or dont is in their and if not I would process the entire buffer but your solution is wayyyyy better Im going to practice more re expressions cause I overcomplicated things haha
I forgot AOC could also be called Advent of Regex LMFAO
Regex is the one time I cheat and look up what I'm doing in the documentation. After all these years, I've still not memorized a damn thing ;-)
@@MichaelDoornbos BRO! I feel understood HAHA
I should probably learn regular expression
Good solution. The part
if match[2] == "do()":
enabled = True
else:
enabled = False
might be simplified to: enabled = match[2] == "do()"
true! thanks for pointing that out
no, it can not. If enabled is False, but it matched some numbers (e.g. ('1', '2', '')) then enabled = match[2] == "do()" will give False, and it will break the logic, you try to run with your version