In this Python for beginners tutorial we are going to learn the following:
How to create a Function
When to use a Function
In this video, we are going to learn about functions, a very important and very useful tool.
A function is just a block of code with a name given by us. If in our program we need to use the same block of code over and over again instead of writing the same block of code many times, we write it once, we give it a name, that’s the function name, and when we need to run it, we just “call” it, as we say.
To define a function, we need to type the keyword def like this:
def (from define) function_name():
block of code
def the function name open and close parenthesis colon two spaces and the block of code we want to belong to the function. Each command, to belong to a function, must be indented with two spaces.
#pythoncourse #pythontutorial #programmingwithnick
Смотрите видео Functions - Python for Absolute Beginners Course онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Programming With Nick 07 Июнь 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 307 раз и оно понравилось 19 людям.