Dark theme

In this part, we'll look at making functions. In some languages these are called sub-routines, methods, or proceedures, but they are all roughly the same thing: chunks of code separated off from the main program which you can call to do jobs for you, and which you can use as often as you like.

We've already seen a number of functions built into Python (e.g. the print() function) or from external libraries (e.g. the random.randint() function). Now we'll make our own.

[Home > Part 3 > Next]