No description
Find a file
2024-06-20 12:44:00 +02:00
population_growth.py Add tests 2024-06-20 12:44:00 +02:00
README.md Add tests 2024-06-20 12:44:00 +02:00
tests.py Add tests 2024-06-20 12:44:00 +02:00

exercise-growth

In a small town the population is 1000 at the beginning of a year. The population regularly increases by 2 percent per year and moreover 50 new inhabitants per year come to live in the town. How many years does the town need to see its population greater than or equal to 1200 inhabitants?

The function should return n number of entire years needed to get a population greater or equal to the population to surpass.

New population coming from outside is an integer, the percentage augmentation is a positive or null floating number, the base population and the population to surpass are positive integers (> 0).

Examples:

function(1000, 2, 50, 1200) -> 3
function(1500, 5, 100, 5000) -> 15
function(1500000, 2.5, 10000, 2000000) -> 10

Note:

There are no fractions of people. At the end of each year, the population count is an integer: 252.8 people round down to 252 persons.