0
[待解决问题]

（一年按52周算）

0

python

# 定义变量

initial_ability = 1
learn_rate = 0.01
lose_rate = -0.01
semester_weeks = 18
break_weeks = {
"winter": 6,
"summer": 10
}
total_weeks = 52

# 计算每周结束时的能力值

weekly_ability = []
for i in range(total_weeks):
if i % (semester_weeks + break_weeks["winter"] + break_weeks["summer"]) < semester_weeks:
weekly_ability.append(initial_ability * (1 + learn_rate))
else:
weekly_ability.append(initial_ability * (1 + lose_rate))
initial_ability = weekly_ability[-1]

# 计算一年结束时的能力值

final_ability = initial_ability

# 输出结果

print("一年内每天学习的人，能力值为：", final_ability)

initial_ability = 1
for i in range(total_weeks):
if i % (semester_weeks + break_weeks["winter"] + break_weeks["summer"]) < semester_weeks or i % 7 in [5, 6]:
initial_ability *= (1 + learn_rate)
else:
initial_ability *= (1 + lose_rate)

print("一年内每天不学习的人，能力值为：", initial_ability)

if initial_ability > final_ability:
print("每天不学习的人比每天学习的人能力值高")
elif initial_ability < final_ability:
print("每天学习的人比每天不学习的人能力值高")
else:
print("每天学习和不学习的人能力值相同")

Technologyforgood | 园豆：7221 (大侠五级) | 2023-04-06 19:55
0
``````每天学习：1*1.01**(52*7)

``````
Sunny-King | 园豆：363 (菜鸟二级) | 2023-04-10 09:18
0

# （一年按52周算）

people1=1
poeple2=1#两个人的初值相同
week=1#现在是第一周
while week<53:
i=1
while i<8:
people1=people11.01
i+=1
week+=1
print(people1)
week=1#现在是第一周
while week<53:
if week<19:
i=1
while i<8:
if i < 6:
poeple2
=1.01
i+=1
else:
poeple2=0.99
i+=1
week+=1
elif 18<week<18+7:
i=1
while i<8:
poeple2
=0.99
i+=1
week+=1
elif 18+6<week<18+6+19:
i=1
while i<8:
if i <6:
poeple2=1.01
i+=1
else:
poeple2
=0.99
i+=1
week+=1
elif 18+6+18<week<18+6+18+11:
i=1
while i<8:
poeple2*=0.99
i+=1
week+=1
print(poeple2)

您需要登录以后才能回答，未注册用户请先注册