Do day 1 and 2.

This commit is contained in:
2023-12-03 18:05:09 -05:00
commit dd1350f285
6 changed files with 4941 additions and 0 deletions

40
d3.py Normal file
View File

@@ -0,0 +1,40 @@
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("i3.txt").read())
print("Solution 1:", solve(data))
return
example = clean(EXAMPLE)
print("Example 2:", solve2(example))
return
data = clean(open("i3.txt").read())
print("Solution 2:", solve2(data))
return
if __name__ == "__main__":
main()