From 54895fc87443e743ea41275c31d4869a9a5b4d82 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 29 Dec 2024 14:32:33 -0500 Subject: [PATCH] 2018: d01: ex1: add solution --- 2018/d01/ex1/ex1.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 2018/d01/ex1/ex1.py diff --git a/2018/d01/ex1/ex1.py b/2018/d01/ex1/ex1.py new file mode 100755 index 0000000..bcffca7 --- /dev/null +++ b/2018/d01/ex1/ex1.py @@ -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()