In this module, we will learn how to package code in custom Functions so it is easily reusable throughout our code.
So far, we have seen how we can use Variables in Python to store different kinds of data, and how we can use 'flow control' structures such as Conditionals and Loops to change the order or the way in which lines of code get executed. With only these tools we can already start to express some pretty complex logics. However, with only our current tools, any sufficiently complex script would start to get very long, since every time we wanted to do a certain process we would have to rewrite all of its code.
This is where Functions come in. Functions allow us to encapsulate lines of code to create custom processes that can be reused anywhere throughout the script.
|Functions and recursion|
|3||Exercise: Branching tree|