Last active
September 26, 2023 17:55
-
-
Save BazingaThat/bb8d4dce0447c154a395c439a1b82574 to your computer and use it in GitHub Desktop.
AOC Day1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Online Python - IDE, Editor, Compiler, Interpreter | |
f = open("AOCDay1.txt", "r") | |
with open('AOCDay1.txt') as f: | |
elf_calories = [line.rstrip('\n') for line in f] | |
print(elf_calories) | |
elves = [] | |
i = 0 | |
for elf in elf_calories: | |
if elf != "": | |
elves[i] += elf | |
else: | |
i += 1 | |
#add all the lines to current elf, then if theres a blank than move to the next elf. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment