December 2013
Intermediate to advanced
152 pages
2h 8m
English
CHAPTER 8
![]()
Functions
We have already shown the functions that are built into Python. Although there is a wealth of functions available to us, there will be times that you need to create your own. In some other programming languages, functions are known as subroutines.
There are usually two reasons for functions. The first is to organize the code into a logical way to handle certain tasks. The other is to be able to reuse code. The general rule of thumb is that if you have a block of code that gets called more than once, put it in a function.
Structure of a Function
The structure of a function is very simple but very important.
def {FunctionName}[(parameters)]: ...Read now
Unlock full access