Track 4 · Lesson 4 of 11
Accumulators: totals, counts and built-up strings
Combine values across iterations with the accumulator pattern: running totals, counters, averages and strings built piece by piece.
You will be able to
- Use the accumulator pattern: set up before the loop, update inside, use after
- Keep a running total and a count in the same loop
- Compute an average safely, including when there are no values
- Build a string one piece at a time inside a loop
Included with a Formula Quest membership
It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.