Question: Question 3 - Recursive functions (15 pts] Rewrite getGrowth function from Question 1 in a recursive way but this time we don't need a list

 Question 3 - Recursive functions (15 pts] Rewrite getGrowth function from

Question 3 - Recursive functions (15 pts] Rewrite getGrowth function from Question 1 in a recursive way but this time we don't need a list nor to return the result in a list. The function should return the estimated number of population for year n given year zero, rate, number of immigrants per year and the number of years. The signature of the function shall remain similar to the previous one: getGrowth Recursive(population_year_zero, rate, immigration_per_year, nbr_of_years) For example, if the population for year zero was 1000., the rate of growth is 2% (0.02), immigration per year is 10 and we want to know the population after 3 years, then the call for the function should be: growth_estimate = getGrowth(1000, 0.02, 10,3) Then if you print the result with print(growth_estimate ) you should get a result like this: 1091.812 which represents the population after 3 years

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!