II. Code reuse

When writing code, some of the steps are often repeated. It can be a small block of 3-5 lines, or it can be a fairly large sequence of steps. Copying code is a bad idea. Because if you have to update one of copies later, you have to update others.

Instead, you create a special code block with name - function. And every time code has to be repeated, you just call a function. Function allows not only to name a block of code but also to make it more abstract through parameters. Parameters make it possible to pass different data for function. And get different results depending on input parameters.

Section 9. Functions covers with creation of functions, section 10. Useful functions discusses useful built-in functions.

Once code is divided into functions, there comes a time when you need to use function in another script. Of course, copying a function is as inconvenient as copying a normal code. Modules are used to reuse code from another Python script.

Section 11. Modules is dedicated to creating your own modules and section 12. Useful modules covers useful modules from Python standard library.

The last section 13. Iterators, iterable and generators is dedicated to iterable objects, iterators and generators.