帮助python代码 [英] help with python code
问题描述
一个行政区对未来几年人口变化做出如下预测:
? 2004年初有26000名居民
?出生率和死亡率分别估计为人口的0.7%和0.6%
?每年进出自治市的人数估计分别为300和325.
i必须编写一个程序来计算自治市镇开始时的估计人口数量。年份。有问题的年份应该是用户要求的。
我有,去,但似乎没有用。我想知道如何启动代码。
A borough has made the following prognosis for the changes in population over the next few years:
? At the start of 2004 there were 26 000 inhabitants
? The rates of births and deaths are estimated at 0.7% and 0.6% of the population respectively
? The number of people moving in and out of the borough annually is estimated at 300 and 325 respectively.
i have to write a program that calculate the borough?s estimated population at the beginning of a particular year. The year in question should be requested from the user.
i have had, go, but does not seem to work. i would like help on how to start the code.
推荐答案
向我们展示你到目前为止所做的工作,我们将尽力提供帮助。
我认为计算会是这样的:
人口+ =人口*(birth_rate - death_rate)
人口+ = (movein_rate - moveout_rate)
这个计算需要在目标日期和2004年之间的差异中每年完成。
我将创建一个返回预计人口的函数。
Show us the work you have done so far, and we will try to help.
I think the calculation will go something like this:
population += population*(birth_rate - death_rate)
population += (movein_rate - moveout_rate)
This calculation will need to be done for each year in the difference between the target date and 2004.
I would create a function that returns the projected population.
一个简单的公式。
(BasePopulation +(MoveinRate - MoveoutRate)*年)*年^(BirthRate - DeathRate)
如果我正确记住我的数学。我不确定的东西。
its a simple formula.
(BasePopulation + (MoveinRate - MoveoutRate) * year) * year^(BirthRate - DeathRate)
If i remember my math correctly. Something i''m not sure of.
尝试使用它来启动
try using this to start
这篇关于帮助python代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!