Do days 5 and 6.
This commit is contained in:
44
dx.py
Normal file
44
dx.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from string import ascii_lowercase, ascii_uppercase, digits
|
||||
import re
|
||||
|
||||
EXAMPLE = """
|
||||
"""
|
||||
|
||||
def str_to_int_lst(s):
|
||||
return list(map(int, s.split()))
|
||||
|
||||
def clean(text: str) -> list[str]:
|
||||
return list(filter(lambda l: l.strip() != "", text.splitlines()))
|
||||
# return list(text.splitlines())
|
||||
|
||||
def solve(lines: list[str]):
|
||||
res = 0
|
||||
for (i, line) in enumerate(lines):
|
||||
print(i, line)
|
||||
return res
|
||||
|
||||
def solve2(lines: list[str]):
|
||||
res = 0
|
||||
for (i, line) in enumerate(lines):
|
||||
print(i, line)
|
||||
return res
|
||||
|
||||
def main():
|
||||
example = clean(EXAMPLE)
|
||||
print("Example 1:", solve(example))
|
||||
return
|
||||
|
||||
data = clean(open("i5.txt").read())
|
||||
print("Solution 1:", solve(data))
|
||||
return
|
||||
|
||||
example = clean(EXAMPLE)
|
||||
print("Example 2:", solve2(example))
|
||||
return
|
||||
|
||||
data = clean(open("i5.txt").read())
|
||||
print("Solution 2:", solve2(data))
|
||||
return
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user