A function is a group of instructions together that are all represented by a single name. To create a function we have to use the special word ‘def’ before we state our function. Followed by ‘def’ will be the name of the function and after that two parenthesis ‘()’

So lets say you want to say a lot of times in your program a couple of sentences like:

‘When i was a little bitty baby’
‘My mama would rock me in the cradle’
‘In them old cotton fields back home’

So normally, you would have to type it a lot of times, or in the best of cases you would copy paste it. If you create a function you will make everything easier, because you’ll just have to name it once and then just call it by its name.

So, according to the way we must define it it would be something like this

How to call functions
How to call functions

In the previous picture you can also see hoe i called it. You just have to type the name of the function followed by two parenthesis and thats it.

CC BY 4.0 How to create and call functions by fersabal is licensed under a Creative Commons Attribution 4.0 International License.