2018: d01: ex1: add solution
This commit is contained in:
parent
dae2865c13
commit
54895fc874
20
2018/d01/ex1/ex1.py
Executable file
20
2018/d01/ex1/ex1.py
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def solve(input: str) -> int:
|
||||||
|
def parse(input: list[str]) -> list[int]:
|
||||||
|
return [int(n) for n in input]
|
||||||
|
|
||||||
|
deltas = parse(input.splitlines())
|
||||||
|
return sum(deltas)
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
input = sys.stdin.read()
|
||||||
|
print(solve(input))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in a new issue