Chapter 4. Control Structures and Functions
This chapter’s first two sections cover Python’s control structures, with the first section dealing with branching and looping and the second section covering exception-handling. Most of the control structures and the basics of exception-handling were introduced in Chapter 1, but here we give more complete coverage, including additional control structure syntaxes, and how to raise exceptions and create custom exceptions.
The third and largest section is devoted to creating custom functions, with detailed coverage of Python’s extremely versatile argument handling. Custom functions allow us to package up and parameterize functionality—this ...
Get Programming in Python 3: A Complete Introduction to the Python Language 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.