Skip to content

Instantly share code, notes, and snippets.

@tapionx
Created December 1, 2019 16:08
Show Gist options
  • Save tapionx/d83c3e0c360491f3e6985a355073e012 to your computer and use it in GitHub Desktop.
Save tapionx/d83c3e0c360491f3e6985a355073e012 to your computer and use it in GitHub Desktop.
Advent of Code 2019 #1 solution
with open('1_input.txt', 'r') as f:
input_data = f.readlines()
def fuel_requirement(mass):
fuel_needed = (mass / 3) - 2
while fuel_needed > 0:
fuel_needed += (fuel_needed / 3) - 2
print(fuel_requirement(14))
print(fuel_requirement(1969))
print(fuel_requirement(100756))
fuel_sum = 0
for module_mass in input_data:
fuel_sum += fuel_requirement(int(module_mass))
print(fuel_sum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment