Skip to content

Instantly share code, notes, and snippets.

@BazingaThat
Last active September 26, 2023 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save BazingaThat/bb8d4dce0447c154a395c439a1b82574 to your computer and use it in GitHub Desktop.
Save BazingaThat/bb8d4dce0447c154a395c439a1b82574 to your computer and use it in GitHub Desktop.
AOC Day1
# 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