Subscribe Contact

Home  »  Chapter 6 : Functions
Function Concepts

Overview

Functions in Python, as in most programming languages, are self-contained modules of code that perform a specific task. These blocks of code are designed to be reusable, making programs more modular, efficient, and manageable. A function typically takes inputs (known as arguments or parameters), performs some operations on these inputs, and then returns a result (known as a return value).

Built-In Functions

Python comes with a large standard library that includes many built-in functions. These are functions that are always available for use without the need to import any additional modules. These functions are designed to provide basic functionality that is commonly needed in Python programs. The following page provides an introduction to built-in functions in Python.

Programmer-Defined Functions

In addition to the the standard library functions, Python allows programmers to define their own functions. These programmer-defined functions are created to perform specific tasks that might not be covered by the standard library. This is where the real power of functions becomes evident, as they can be tailored to the exact needs of the program. Programmer-defined functions are covered in detail later in this chapter.


Page Menu: 

Advantages of Using Functions

Functions are a fundamental aspect of Python programming. They help in organizing code into manageable chunks, promoting code reuse, and making complex programs more understandable. Whether using Python's robust standard library or creating your own functions, they are essential tools for effective programming.



 


«  Previous : Functions
Next : Functions : Built-In Functions  »



© 2023 John Gordon
Cascade Street Publishing, LLC