You will write a small cost-benefit tool. It discounts each year's net benefit and decides whether a project is worth doing, first for its owner and then for society.
The idea. A sum that comes years from now is worth today. The net present value is the sum of these over the project's life, minus the cost now.
Your tasks.
present_value, return the value today of amount received years years from now.npv, return the net present value of a project that costs cost_now and gives yearly every year for life years.decide, return "build" if the social NPV (benefit minus harm each year) is positive, and "do not build" otherwise.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…