1.代码
# 拓展:假如需要一年创收不小于37.78倍(每天创收1%),又想“三天打鱼两天晒网”,请问每周三天需要创收多少比例?
#设一年前的初始值为1
def DayUp(df): #函数的定义
dayup = 1
for i in range(365):
if i%7 in [0,6]:
dayup = dayup*(1-.01)
else:
dayup = dayup*(1+df)
return dayup
dayfactor = 0.01
while DayUp(dayfactor)<37.78:
dayfactor +=0.001
print('工作日的努力里参数是:{:.3f}'.format(dayfactor))