Iteration Patterns

Map, filter, reduce as common loop shapes.

Do this: Read the concept below, then try the quiz or activity.

Lesson 7 of 20
30%

Concept

Many tasks fit patterns: map transforms each item; filter keeps some items; reduce folds many values into one. Prefer built-ins where idiomatic.

Order the steps to filter even numbers

These steps are out of order — can you fix them?

1.Check if divisible by 2
2.Keep passing items
3.Iterate items
4.Return result list