Skip to content

Instantly share code, notes, and snippets.

@AmandaLowery
Created December 4, 2019 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save AmandaLowery/4e747cfeae429bed0ffc5d55999ded8e to your computer and use it in GitHub Desktop.
Save AmandaLowery/4e747cfeae429bed0ffc5d55999ded8e to your computer and use it in GitHub Desktop.
Day 1 Part 2
with open("Day1_input.txt", "r") as f:
modules = [int(x) for x in f.readlines()]
#part 1
fuel = sum((y // 3 - 2) for y in modules)
print(fuel)
#3390596
#holyshit
#part 2
total_fuel = 0
for y in modules:
fuel_added = y
while True:
fuel_added = (y // 3 - 2)
if fuel_added > 0:
total_fuel += fuel_added
else:
break
print(total_fuel)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment