Composing a Full Report

With the pieces in place, a report is just calling them in order and formatting the output. Notice how readable the final section is: it reads almost like the original question.

EXAMPLE
loading editor…
YOUR TURN
Your turn → This is a complete, useful program. Add a line reporting the city with the most total hours, using the grouping you already built.
loading editor…

Syntax has to be exact. Every quote, bracket and parenthesis needs its partner, and in Python the spaces at the start of a line count. One slip and the program won't run; the message will say where.

◈ Graded Challenge

Write a function that takes a list of volunteer records (name, hours, active) and returns the total hours contributed by ACTIVE volunteers only. Inactive volunteers must be excluded entirely.

Name it exactly: def active_hours(people):

3 visible + 2 hidden
loading editor…

Mark this lesson complete

Signed in, your progress follows you to every device.

Next: Practice Test →
← Back