aboutsummaryrefslogtreecommitdiff
path: root/2018/01.py
diff options
context:
space:
mode:
Diffstat (limited to '2018/01.py')
-rw-r--r--2018/01.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/2018/01.py b/2018/01.py
new file mode 100644
index 0000000..7a7dc3a
--- /dev/null
+++ b/2018/01.py
@@ -0,0 +1,21 @@
+# Day One: Chronal Calibration
+
+file = open("input/01.txt").readlines()
+
+total = 0
+for line in file:
+ if line != '\n':
+ total += int(line)
+print(total)
+
+total = {0}
+current = 0
+while True:
+ for line in file:
+ if line != '\n':
+ current += int(line)
+ if current not in total:
+ total.add(current)
+ else:
+ print(current)
+ quit()