summaryrefslogtreecommitdiff
path: root/2018/aoc2018-d01-2.py
blob: ee8bab255a70534cbd3088b73ce2f1c9da24c7e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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);