Functions
What do they do?
Functions in Python are like little helpers that can do specific tasks for us. They can take in some information, do something with it, and then give us back a result. By using functions, we can avoid repeating the same code over and over again, which can our programs easier to read and write. It's like having a bunch of little robots that can do different things for us, so we don't to do everything ourselves.
Defining Them
How?
​
def function(parameter):
This is how to define a function, parameter will be referred to as parameter in the subsequent code.
Defining a function is like creating a recipe for a cake. You write down the steps needed to make the cake, like mixing the ingredients and baking it in the oven. When you want to make the cake, you follow the recipe and it turns out just right.
Adding parameters to a function is like adding different flavors to the cake. You can make a chocolate cake or a vanilla cake by changing the ingredients. In the same way, you can make a work with different values by adding parameters. It's like telling the function what ingredients to use when it runs.