Part IV. Functions
In Part IV, we study the Python
function—a package of code that can be called repeatedly, with
different inputs and outputs each time. We’ve
already been calling functions earlier in the book:
open
, to make a file object, for instance. Here,
the emphasis will be on coding user-defined functions, which compute
values, perform part of a program’s overall logic,
or otherwise wrap code for easy reuse.
Get Learning Python, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.