Question: Create a Python module: 1. To do this, just create a Python script in the folder named pop_calculate.py a. Create a function named as_rate which

Create a Python module: 1. To do this, just create a Python script in the folder named pop_calculate.py

a. Create a function named as_rate which accepts the rate in percentage points (as a string). This function will convert the rate and returns that value as a float. Use type hinting for each parameter and that a float will be returned. Use the calculations included below to get the correct value. For testing, if the following arguments are given you should get the associated values:

i. "5" -> 0.05

ii. "1.6" -> 0.016

iii. "2.08" -> 0.0208

iv. "10" -> 0.1

v. "-3" -> -0.03

b. Create a function named years_increase which accepts the current population (as a float) and the growth rate (as a float). This function will calculate the increase in population for the current year and returns that value as a float. Use type hinting for each parameter and that a float will be returned. Use the calculations included below to get the correct value. For testing, if the following arguments are given you should get the associated values:

Population Rate Increase
1000 0.05 50.0
1500 0.016 24.0
1680.2 0.0208 34.94816
9873.54 0.01 98.73540000000001
123456.78 -0.3 -3703.7034

c. Create a function named expected_population which accepts the starting population (as an integer), the time of the population growth in years (as an integer), and the growth rate (as a float). This function will calculate the expected size of the population at the end of the time and returns that value as an integer. Use type hinting for each parameter and that an integer will be returned. Use the calculations included below to get the correct value. For testing, if the following arguments are given you should get the associated values:

Starting Population Growth Rate Time (in years)

Expected Population

1000 0.05 10 1629
1500 0.016 100 7336
1680 0.0208 17 2384
9874 0.01 14 11350
123457 -0.03 34 43828

d. Create a function named ending_population which accepts the starting population (as a float) and the growth rate (as a float). This function needs to calculate the population at the end of the year and returns that value as a float. You will need to use the years_increase function to get the increase of population to add to the starting population. Use type hinting for each parameter and that a float will be returned. Use the calculations included below to get the correct value. For testing, if the following arguments are given you should get the associated values:

Starting Population Growth Rate Ending Population
1000 0.05 1050.0
1500 0.016 1524.0
1715.14816 0.0208 1750.8232417279999
9972.2754 0.01 10071.998154
116160.484302 -0.03 112675.66977294

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!