BetterMeQ 2018-09-20 02:27 采纳率: 0%
浏览 2730

python程序不知道怎么编 希望大佬可以指教

假设能力以7天为周期,连续3天能力值不变,从第4天开始到第7天每天能力增长值为前一天的1%,**如果7天中有一天间断学习,则周期从头计算**。请编写程序回答如果初始能力值为1,连续学习365天后的能力值是多少?
emmm主要是加粗部分不知道怎么编

  • 写回答

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))

    评论

报告相同问题?