STEP 1
A list is an ordered collection; a function can iterate through it one item at a time.
Python Syntax & Type System
Python Syntax & Type System
Python is dynamically typed, but reliable backend code still makes input and output expectations explicit through small, testable functions.
STEP 1
A list is an ordered collection; a function can iterate through it one item at a time.
STEP 2
Use 0 as the accumulator for addition, which also handles an empty list without a special case.
STEP 3
Returning a value makes a function composable; printing is useful for inspection but is not its result.
Build a total one item at a time
Why begin the accumulator at 0?
Next: Phase 2 Hands-On Drill
Solve the coding challenge in the in-browser IDE with live visible and hidden specification tests.