Function Statement and Function Call

This chapter provides introductions and tutorial examples on user defined functions. Topics include defining and calling a function; assigning calling arguments to function parameters; returning object to the calling code; local, enclosing and global variables; using built-in functions; using lambda expression to create anonymous function.

These sections are omitted from this Web preview version. To view the full content, see information on how to obtain the full version this book.

What Is Function

Built-In Functions

"def" Statement - Define Functions

"f(...)" - Function Call Operation

What Is Function Parameter

What Is Function Call Argument

Assign Function Call Arguments to Parameters

Special Function Parameters - "*" and "/"

"return" Statement Used in Functions

Variable Scope: LEGB (Local, Enclosing, Global, Built-in)

"global" Statement - Declare Global Variables Locally

"nonlocal" Statement - Declare Enclosing Variables Locally

"lambda" Expression - Simple Anonymous Function


Table of Contents

 About This Book

 Running Python Code Online

 Python on macOS Computers

 Python on Linux Computers

 Built-in Data Types

 Variables, Operations and Expressions

 Statements - Execution Units

Function Statement and Function Call

 Iterators, Generators and List Comprehensions

 Classes and Instances

 Modules and Module Files

 Packages and Package Directories

 "sys" and "os" Modules

 "pathlib" - Object-Oriented Filesystem Paths

 "pip" - Package Installer for Python - Python Libraries for Science

 pandas - Data Analysis and Manipulation

 Anaconda - Python Environment Manager

 Jupyter Notebook and JupyterLab


 Full Version in PDF/EPUB