How to Write Your Own Functions - Python Tutorial #14

Опубликовано: 30 Март 2018
на канале: DMK Data
61
1

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.


Смотрите видео How to Write Your Own Functions - Python Tutorial #14 онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь DMK Data 30 Март 2018, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 61 раз и оно понравилось 1 людям.