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

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
	  

你可能感兴趣的:(Python入门)