AdventOfCode/2019/day1.py
Adrien Abraham 7e025a3721 Days 1 and 2
2019-12-02 13:59:18 +01:00

12 lines
256 B
Python

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)