December 2017
Beginner to intermediate
410 pages
12h 45m
English
Functions are one of the cornerstones of programming. They provide a way to reuse code. If you’ve ever copy-pasted lines of code just to change a few parameters, then turning those lines of code into a function not only makes your code more readable, but also prevents you from making mistakes later on. Every time code is copy-pasted, it adds another place to look if a correction is needed, and puts that burden on the programmer. When you use a function, you need to make a correction only once, and it will be applied every time the function is called.
I highly suggest the Software-Carpentry Python episode on functions for more details.1
1. http://swcarpentry.github.io/python-novice-inflammation/06-func/
An empty function looks like ...