You will write three small functions that turn everyday choices into kilograms of carbon dioxide equivalent.
The idea. Burning one litre of petrol gives . Electricity gives its energy in kWh times the grams for each kWh, divided by to give kg. A tree takes up about of carbon dioxide in a year.
Your tasks.
petrol_co2, return the kg of carbon dioxide from litres of petrol.electricity_co2, return the kg from kwh of electricity at grams of CO2e for each kWh.trees_needed, return how many trees take up kg of carbon dioxide in a year, with per_tree kg for each tree.Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…