curriculum/challenges/english/blocks/daily-coding-challenges-python/69272dcf1c24b44fd79137c4.md
Given the numbers of gallons of fuel currently in your airplane, and the required number of liters of fuel to reach your destination, determine how many additional gallons of fuel you should add.
0.fuel_to_add(0, 1) should return 1.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(fuel_to_add(0, 1), 1)`)
}})
fuel_to_add(5, 40) should return 6.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(fuel_to_add(5, 40), 6)`)
}})
fuel_to_add(10, 30) should return 0.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(fuel_to_add(10, 30), 0)`)
}})
fuel_to_add(896, 20500) should return 4520.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(fuel_to_add(896, 20500), 4520)`)
}})
fuel_to_add(1000, 50000) should return 12209.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(fuel_to_add(1000, 50000), 12209)`)
}})
def fuel_to_add(current_gallons, required_liters):
return current_gallons
import math
def fuel_to_add(current_gallons, required_liters):
liters_per_gallon = 3.78541
current_liters = current_gallons * liters_per_gallon
if current_liters >= required_liters:
return 0
liters_needed = required_liters - current_liters
return math.ceil(liters_needed / liters_per_gallon)