This repository has been archived on 2024-12-22. You can view files and clone it, but cannot push or open issues or pull requests.
aoc2023/d4.py
2023-12-03 17:23:36 -05:00

41 lines
764 B
Python

import re
EXAMPLE = """
"""
def clean(text: str) -> list[str]:
return list(filter(lambda l: l.strip() != "", text.splitlines()))
def solve(lines: list[str]):
s = 0
for (i, line) in enumerate(lines):
print(i, line)
return s
def solve2(lines: list[str]):
s = 0
for (i, line) in enumerate(lines):
print(i, line)
return s
def main():
example = clean(EXAMPLE)
print("Example 1:", solve(example))
return
data = clean(open("i4.txt").read())
print("Solution 1:", solve(data))
return
example = clean(EXAMPLE)
print("Example 2:", solve2(example))
return
data = clean(open("i4.txt").read())
print("Solution 2:", solve2(data))
return
if __name__ == "__main__":
main()