Going back to Chapter 1, What is Programming?, you may remember that we defined programming as writing a set of instructions for a computer to execute. A function is a block of reusable code or instructions which generally performs a single specific task. A function abstracts one or more instructions and gives us a reference to that block of instructions. Chapter 4, Favorite Things, showed us how to reference values using variables. In this chapter, you will learn that a function is basically a set of instructions or a chunk of code that is grouped together and referenced by a function name.
Let's imagine a real-world example for a moment. When you want to order a pizza, you call your local pizza joint. The people working at the pizza joint will then note down your order, put it into their queue of orders, make the pizza specified in your order and lastly, have it delivered to your address.
Actually, we can model these tasks as multiple functions:
A function to receive the...