最佳答案
我用python计算出如果每7秒出生一个孩子5年内会有多少个孩子出生。问题在我的最后一行。我如何得到一个变量的工作时,我打印文本的任何一方?
这是我的代码:
currentPop = 312032486
oneYear = 365
hours = 24
minutes = 60
seconds = 60
# seconds in a single day
secondsInDay = hours * minutes * seconds
# seconds in a year
secondsInYear = secondsInDay * oneYear
fiveYears = secondsInYear * 5
#Seconds in 5 years
print fiveYears
# fiveYears in seconds, divided by 7 seconds
births = fiveYears // 7
print "If there was a birth every 7 seconds, there would be: " births "births"