Day 1
This commit is contained in:
18
day01/part1.py
Normal file
18
day01/part1.py
Normal file
@@ -0,0 +1,18 @@
|
||||
items = [int(x.strip()) for x in open("input.txt")]
|
||||
|
||||
lows = []
|
||||
highs = []
|
||||
|
||||
for item in items:
|
||||
if item < 1010:
|
||||
lows.append(item)
|
||||
else:
|
||||
highs.append(item)
|
||||
|
||||
print(lows)
|
||||
print(highs)
|
||||
|
||||
for low in lows:
|
||||
for high in highs:
|
||||
if low + high == 2020:
|
||||
print("Found {} and {}: Sum={} Product={}".format(low, high, low+high, low*high))
|
||||
Reference in New Issue
Block a user