Exercise 3.1 python problem: every day forces

1. Every day upward force

Working mode should strive to what level, in order to like the effort of 1% a day?

-A Jun: 365 days a year, increased by 1% per day, do not stop

Jun -B: 365 days a year, 2 days off work five days a week, rest days decreased by 1%, to more effort?

Work five days a week to rest two days, calculated effort working parameters can be much like the effort of 1% per day.

Requirements are as follows

(1) 365 days a year, with a value of 0-day capacity base, referred to as 1.0;

(2) When the learn, the ability value with the previous day 1%; when there is no learning, forgotten since the previous day and other reasons capacity values decreased 1%;
output
the output format is as follows :( wherein the result after three decimal places, there is a space after the colon)

Efforts are working parameters: 0.019

def dayUP(df):
    dayup = 1
    for i in range(365):
       if i % 7 in [6,0]:
           dayup = dayup*(1 - 0.01)
       else:
           dayup = dayup*(1 + df)
    return dayup
dayfactor = 0.01
while dayUP(dayfactor)<37.78:
    dayfactor += 0.001
print("工作日的努力参数是:{:.3f} ".format(dayfactor))
工作日的努力参数是:0.019 

note

Study title source for Python123 platform and Chinese University of MOCC "Python Programming Language" course, Speaker Teacher: Song days, Huang Tianyu, Yan ceremony. If infringement, stand deleted.

Published 59 original articles · won praise 35 · views 1743

Guess you like

Origin blog.csdn.net/weixin_43412569/article/details/104886782