-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday1.py
33 lines (27 loc) · 771 Bytes
/
day1.py
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
33
i = open("input/day1.txt", "r")
i = i.read().split('\n')
i = [int(x) for x in i]
flag = False
print('=== PART #1 ===')
for first in i:
for second in i:
if first + second == 2020:
print(f'first: {first}; second: {second}; equals: {first + second}')
flag = True
break
if flag: break
print(first*second)
print('=== PART #2 ===')
flag = False
for first in i:
for second in i:
for third in i:
if first + second + third == 2020:
print(f'first: {first}; second: {second}; third: {third}; equals: {first + second + third}')
flag = True
break
if flag: break
if flag: break
print(first*second*third)
#if __name__ == "__main__":
#pass