Pollution¶
Write the function carbon_dioxide() that takes an amount of
liters of oil to make gas, and returns the number of kg of CO2 (carbon
dioxide) that will be produced with this amount of oil, knowing the
following conversions:
1 barrel of oil contains 158.987 liters of oil
with a barrel of oil, 74 liters of gas can be produced
2.3 kg CO2 are generated for each liter of gas
Save this function into a file named pollution.py.
See the following examples:
>>> round(carbon_dioxide(2.1485), 3)
2.3
>>> round(carbon_dioxide(158.987), 3)
170.2
>>> oil_liters = 158.987*2
>>> round(carbon_dioxide(oil_liters), 3)
340.4
Note
More tests are provided in the pollution.txt file.
Solution
A solution is provided in the
pollution.py file.