Day 1 2022

This commit is contained in:
Julia Lange 2022-11-30 21:09:48 -08:00
parent 640e7a29b1
commit fa98ccf4c3
Signed by: Julia
SSH key fingerprint: SHA256:KI8YxpkPRbnDRkXPgCuQCVz181++Vy7NAvmQj8alOhM
2 changed files with 33 additions and 0 deletions

14
Python/2022/01/input Normal file
View file

@ -0,0 +1,14 @@
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000

19
Python/2022/01/main.py Normal file
View file

@ -0,0 +1,19 @@
input = open("input", 'r')
data = [0 for _ in range(400)]
elf = 0
for line in input:
if line == "\n":
elf += 1
else:
if data[elf]:
data[elf] += int(line)
else:
data[elf] = int(line)
sortedData = sorted(data, reverse=True)
print(sortedData[0])
print(sortedData[0] + sortedData[1] + sortedData[2])