Day 1
This commit is contained in:
16
day1/day1.py
Normal file
16
day1/day1.py
Normal file
@@ -0,0 +1,16 @@
|
||||
with open("./day1.txt", "r") as f:
|
||||
file = f.read()
|
||||
|
||||
|
||||
x = file.split("\n")
|
||||
res = []
|
||||
highest = 0
|
||||
current = 0
|
||||
for i in x:
|
||||
if i != "":
|
||||
current += int(i)
|
||||
else:
|
||||
res.append(current)
|
||||
current = 0
|
||||
res.sort(reverse=True)
|
||||
print(res[0] + res[1] + res[2])
|
||||
2237
day1/day1.txt
Normal file
2237
day1/day1.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user