Here are the numbers of people in three broad age groups for three towns. You will find the share of children, the dependency ratio and the shape of each pyramid.
The idea. The dependency ratio compares the people who usually do not work (under 15 and 65 or over) with those of working age (15 to 64):
with young under 15, old 65 and over, and working age 15 to 64.
For this lab, use a simple rule for the shape: a share of children of 30 % or more is expanding, under 18 % is declining, and anything between is stable.
Your tasks.
share_children, return the percentage of the town's people who are under 15.dependency_ratio, return the dependency ratio of the town.shape, return "expanding", "stable" or "declining" by the rule above.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…