So far we mainly used functions that are built into python but it is both easy and useful to write your own functions. When we program we usually solve problems and we can write a script that solves a problem but it is much better practice to write a function that solves a problem. The reason is that functions have well defined inputs and output and we can reuse the function as many times as we want, both in the same program or in another program where we import the function.
We call the input to a function a parameter or an argument. The parameters are what the function works on. A function can do work through side-effects or output return. Side-effects are things a function does directly to the parameters , console or the OS.
Output return on the other hand gives us a result that the function came up with and it can do so without changing any of the parameters directly. We take the output by assigning a name to the function call like this: output_name = Function()
Oh and about the meat grinder thumbnail. I was trying to find a picture of a sausage factory but I wasn't happy with the result.
Watch video How to Write Your Own Functions - Python Tutorial #14 online without registration, duration hours minute second in high quality. This video was added by user DMK Data 30 March 2018, don't forget to share it with your friends and acquaintances, it has been viewed on our site 61 once and liked it 1 people.