Kodewick
Start learning →
Mini challenge←→0 / 100

Weekly reading report

#098Mini challengeMixedDicts7 min

A reading log holds how many minutes were read on each of 7 days. Write reading_report(minutes) to return a dict: "total" is all the minutes, "best_day" is which day had the most (counting from 1; on a tie, the earlier day), and "good_days" is how many days had 30 minutes or more.

Examples
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}
main.py
def reading_report(minutes):
    good_days = 0
    for m in minutes:
        # your code here: 30 or more adds 1 to good_days
        pass
    # your code here: work out total and best_day
    total = 0
    best_day = 0
    return {"total": total, "best_day": best_day, "good_days": good_days}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.