我正在尝试获得选定月份期间的百分比增长,.i似乎无法掌握如何利用当前月值来计算新月份并将所有月份相加。
NOC = int(input('Please enter the number of chickens : '))
MONTHS = int(input('Please enter the number of months for the estimate : '))
FCE = NOC*10*MONTHS/100
if NOC == '' and MONTHS =='' :
print('please Enter a value for month and year')
else:
print('Your Result',FCE)发布于 2020-04-06 19:30:40
如果您正在寻找复合增长,那么您需要迭代每个月,并使用最近几个月的值来增加
NOC = int(input('Please enter the number of chickens : '))
MONTHS = int(input('Please enter the number of months for the estimate : '))
for month in range(0, MONTHS):
NOC = NOC + (NOC*0.1)
print(NOC)https://stackoverflow.com/questions/61058351
复制相似问题