runtime
97 / 500
question 97 Fundamentals Integration · medium

Weekly totals from daily steps

A fitness app stores one step count per day, oldest first. The weekly view groups them into blocks of 7 days starting from the first day; a final block shorter than 7 days is still shown. Return the total of each block.

Functionblock_totals(daily, size=7)
dailya list of whole-number step counts
Returnsa new list with the total of each block of size days, in order; the last block may be shorter
Examples
callblock_totals([8200, 10450, 6120, 9900, 12010, 4300, 7650, 11020, 9050])returns[58630, 20070]
callblock_totals([1000, 2000, 3000], 2)returns[3000, 3000]
callblock_totals([500])returns[500]

Loading your progress…

Weekly totals from daily steps — Python practice · Runtime