欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

python实例---天天向上的力量

程序员文章站 2022-05-18 07:55:31
...

version 1

#daydayup.py
dayfactor=0.005
dayup=pow(1+dayfactor,365)
daydown=pow(1-dayfactor,365)
print(“向上:{:.2f},向上,向下:{:.2f}''.format(dayup,daydown))

version 2

#daydayupq3.py
dayup=1.0
dayfactor=0.01
for i in range(365):
	if i %7 in [6,0]:
		dayup*=(1-dayfactor)
	else:
		dayup*=(1+dayfactor)
print("工作日的力量:{:.2f}".format(dayup))
	

version 3

def dayup(df):
	  dayup=1
	  for i in range(365):
		if i %7 in [6,0]:
			dayup*=(1-0.01)
		else:
			dayup*=(1+df)
		return dayup
dayfactor=0.01
while dayup(dayfactor)<37.78:
	datfactor+=0.001