AdventOfCode/2019/day1.py

12 lines
256 B
Python
Raw Normal View History

2019-12-02 13:59:18 +01:00
def get_fuel(mass):
return mass // 3 - 2
needed_fuel = 0
with open("day1.txt", "rt") as input_file:
for line in input_file.readlines():
mass = int(line.strip())
fuel = get_fuel(mass)
needed_fuel += fuel
print(needed_fuel)