读书打卡记下了一周 7 天每天读了几分钟。写 reading_report(minutes),返回一个字典:"total" 一共几分钟,"best_day" 读得最多的是第几天(从 1 数,一样多取前面的),"good_days" 有几天读了 30 分钟或更多。
reading_report([20, 45, 30, 0, 60, 15, 30])→{'total': 200, 'best_day': 5, 'good_days': 4}reading_report([10, 10, 10, 10, 10, 10, 10])→{'total': 70, 'best_day': 1, 'good_days': 0}def reading_report(minutes):
good_days = 0
for m in minutes:
# 在这里写:30 分钟或更多,good_days 加 1
pass
# 在这里写:算出 total 和 best_day
total = 0
best_day = 0
return {"total": total, "best_day": best_day, "good_days": good_days}
写好了先点「运行」试试示例,没问题再点「提交」。