# Functions

# 5. Functions#

In previous chapters, in every worked exercise, we discussed how to solve a problem by **decomposing the solution into steps.** Sometimes, we decompose the problem into smaller sub-problems that can be decomposed into further steps. In this chapter, we will discuss how to write a sequence of instructions as a function to consider it as a step by itself. We will discuss how to use functions for a sub-problem to solve “the” problem.

Think of assembling an Ikea table. It is difficult to think of building the Ikea table from scratch. Ikea broke the table into smaller pieces and gave us instructions on how to assemble it. We can think of each step as a function.