假设能力以7天为周期,连续3天能力值不变,从第4天开始到第7天每天能力增长值为前一天的1%,**如果7天中有一天间断学习,则周期从头计算**。请编写程序回答如果初始能力值为1,连续学习365天后的能力值是多少?
emmm主要是加粗部分不知道怎么编
python程序不知道怎么编 希望大佬可以指教
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
3条回答
loserun 2020-03-05 14:47关注dayup,dayfactor=1.0,0.01
study,unstudy='x','y'
temp=1
state='x'
for i in range(1,365):
if state==study and(temp in [1,2,3]):
dayup=dayup
temp=(temp+1)%7
elif state==study and(temp in [4,5,6,0]):
dayup=dayup*(1+dayfactor)
temp=(temp+1)%7
elif state==unstudy:
temp=1
print("连续学习365天后能力值是:{:.2f}".format(dayup))评论 打赏 举报解决 1无用