← AI engineering labs

Python project practice

Build one small function from a project brief. Check your solution against the shown example and changed inputs in your browser.

Validate and total study sessions

A ledger can contain old or incomplete entries. Calculate a trustworthy study total before adding persistence.

  • Each row is a dictionary. Read its minutes field if present.
  • Include integers from 1 through 1,440. Ignore missing values, booleans and other invalid durations.
  • Return the sum as an integer. An empty list returns zero.
Example

total_minutes([{"minutes": 20}, {"minutes": -5}, {"minutes": 15}, {}]) → 35

Show hint

In Python, an isinstance check for int also accepts bool. Decide what the data contract allows.

Read M03

Your code runs in a browser sandbox using synthetic inputs. The first run downloads about 7.5 MB. Keep a separate copy if you want to save your work.