Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions

Question

2. Discuss the steps in preparing a manager to go overseas.

Answered: 1 week ago

Question

8. Measure the effectiveness of the succession planning process.

Answered: 1 week ago