summaryrefslogtreecommitdiff
path: root/2018/aoc2018-d01.py
diff options
context:
space:
mode:
authorblenovo <bk@gmail.com>2025-03-04 15:37:55 +0100
committerblenovo <bk@gmail.com>2025-03-04 15:37:55 +0100
commit15662865f0886209d871a7225bfc62cffd2e0783 (patch)
tree7130fb1b11a058ffdbeefe471eccd6ad461d8843 /2018/aoc2018-d01.py
parenta926f0a2aa1818879930f5843d5c2cfabd3bfebc (diff)
transfer from previous server
Diffstat (limited to '2018/aoc2018-d01.py')
-rw-r--r--2018/aoc2018-d01.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/2018/aoc2018-d01.py b/2018/aoc2018-d01.py
new file mode 100644
index 0000000..ee8bab2
--- /dev/null
+++ b/2018/aoc2018-d01.py
@@ -0,0 +1,32 @@
+print();
+f = open("input");
+
+part1 = 0;
+results = [];
+not_found = True;
+loopcount = 0;
+myinput = [];
+
+for i in f:
+ myinput.append(int(i));
+
+while not_found:
+ for i in myinput:
+ #print(i, "endofline");
+ part1 += i;
+ results.append(part1);
+ #for x in results:
+ if (results.count(part1) > 1):
+ part2 = part1;
+ print(part2);
+ not_found = False;
+ break;
+ loopcount += 1;
+ #print("loop", loopcount);
+
+#results.sort();
+#for i in results:
+# print(i);
+
+print(part1);
+print(part2);