Kodewick
Start learning →
Basic←→0 / 80

Time in the study room

#011BasicFunctionsStrings5 min

The study room's door logs when you came in and went out, like "08:15", both on the same day. study_minutes is written and relies on a small helper, to_minutes(clock), which turns "08:15" into minutes since midnight: 495. Finish to_minutes.

Examples
study_minutes("08:15", "09:05")→50
study_minutes("07:00", "07:00")→0
main.py
def to_minutes(clock):
    # your code here: split at the colon into hours and minutes, return the total minutes
    return 0


def study_minutes(start, end):
    return to_minutes(end) - to_minutes(start)
Ctrl + Enter runs too
Result

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