Python for Beginners: 22. Ultimate Guide to User-Defined Functions

preview_player
Показать описание
Learn basics of functions in Python. By the end of this tutorial, you will be able to create your own user-defined functions in Python and use them. #python #programming #function

Code in Google Colab:

Code in GitHub:

TimeStamps:
00:00 Welcome/ Intro
00:43 Understanding functions
01:48 Syntax to Define a Function
03:12 Advantages of using functions
04:29 Minimal valid function
05:07 Simple Function without parameters
06:46 Using Docstring
07:41 Control-flow with functions
10:00 define function before calling
10:22 Function with parameters
11:53 Positional vs. Keyword argument passing
13:52 Errors to avoid
16:20 Function with Default Parameters
17:36 Function that returns
19:00 Outro
Рекомендации по теме
Комментарии
Автор

Hello, could you explain the return line in the else block? I think it's 7 but I'm not sure

def fun(n):
if n == 1:
return 1;
else:
return n + fun(n-1)
print(fun(4))

liri
join shbcf.ru