In Python, a function is a named sequence of statements that performs a computation.
Key term: function
To execute a function, we call it by name and pass it an appropriate set of input arguments. A function takes zero or more arguments as inputs and returns zero or more outputs as a result. The output or result of a function is called the return value.
Key terms: function call, input argument, function output or return value
Data, parameters, or arguments can be passed into a function. Functions can also return data.
Section Contents¶
- Code in Context, Computing & the Liberal Arts
- How to Interact With This Book
- Course Overview
- Binary Number Systems & Encoding Schema
- How Computers Work (Part 1): Computer Hardware & Architecture
- How Computers Work (Part 2): Operating Systems & Interfaces
- Computer Networks & the Internet
- The World Wide Web
- Programming Fundamentals in Python: Variables, Data Types & Operators
- Data Structures in Python
- Control Structures in Python
- Code Reuse & Modularity in Python
- Structured Data in Python