CHAPTER 2

FUNCTIONS

CHAPTER OUTLINE

2.1 Built-in Functions

2.2 Function Definition and Call

2.3 Importing User-defined Module

2.4 assert Statement

2.5 Command Line Arguments

In this chapter, we will learn how simple statements can be put together in the form of functions to do useful tasks. We can easily deal with problems whose solutions can be written in the form of small Python programs. As a problem becomes complex, the program also increases in size and complexity, and it is impossible for a programmer to keep track of the data and control statements in the whole program. Indeed, experience has shown that the most programmers cannot keep track of more than ten statements or so at a time. Therefore, we cannot apply the crude method of attacking ...

Get Python Programming: A modular approach 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.