Functions as values
Line 3 defines double. Give it 3 and it returns 6, every time. It only reads its input and changes nothing outside itself (no side effects): no printing, no global variables, no editing of lists. That is a pure function.
Line 4 hands double to map with no round brackets () after it. Without them you pass the function itself instead of calling it. A function is a value, like 3 or a list: you can store it or pass it on.
The pipeline
map calls double on each value of xs in turn: 3 becomes 6, 1 becomes 2, 4 becomes 8 and 2 becomes 4. The results fill a new list, ys. The list xs is not changed.
Line 5 needs a yes-or-no test for filter. lambda y: y > 4 writes a small function right where it is used, with no def and no name. It returns True when y is bigger than 4.
filter runs the test on each value of ys and keeps only the ones that give True. 6 and 8 pass; 2 and 4 do not, because 4 > 4 is False. They form a new, shorter list, zs.
Python has a shorter way to write line 5: [y for y in ys if y > 4]. It builds the same new list, [6, 8]. A comprehension can transform values too: [x * 2 for x in xs] does the work of map.
reduce combines a list into one value. It calls its function on the first two values, then on that result and the next value, until none are left. Here that is 6 + 8, so total is 14.
Why it helps
Lines 7 and 8 reach the same 14 with a loop. t starts at 0 and each pass overwrites it: 0, then 6, then 14. The pipeline made new values; the loop keeps changing one variable.
To test double, call it and compare: double(3) == 6. No setup, no other state to check. And xs still holds 3, 1, 4, 2: nothing changed it. Treating data as unchangeable is called immutability.
Each call to double needs only its own value and changes nothing shared, so the four calls do not depend on each other. They can safely run at the same time, for example on four processor cores.
Try it in the Python prompt
;; step 1/10 · line 3: def double(x): return x * 2 >>> def double(x): return x * 2 >>> double(3) 6 >>> double(3) # same input, same output 6
In Python 3, map and filter return lazy iterators that make each value only when asked; wrapping them in list(...) runs them and stores the results in a new list. reduce lives in the functools module, which is why line 1 imports it. For adding numbers, the built-in sum(zs) does the same job and is easier to read.