Notes
Functions
Content of the notes (1)
Page 1
Functions — Functions
Functions are reusable pieces of programs that take an input and produce an output.
A function definition is a compound statement consisting of a header and a body.
The header includes the keyword def, a sequence of parameters enclosed by parentheses, followed by a colon :.
The body consists of a sequence of statements, all indented by 4 spaces.
Functions may return a value using the keyword return or have a side effect (e.g., print).
To evaluate a function call, replace the function's parameters in the body of the function by their associated values in the call and execute the body of the function.
Lecture examples - Functions
More examples - Stucture of Functions, Uses of Functions, Scope of Variables, Examples of Functions
Página Nueva
Information
- Description
- An Introduction to Interactive Programming in Python (Week 1 - Functions, logic, conditionals) Note on Functions, created by asderel on 29/04/2013.
- Created by
- asderel
- Views
- 53
- Tags
- Rating