Python Programming: Lesson 15 - Docstrings and Function Reference Variables

preview_player
Показать описание
PLEASE SUBSCRIBE!!!

We know that functions are modular blocks of code that achieve particular tasks. They can accept no inputs, one input, or more than one input. Functions can accept other functions as input.

We know that functions can return values or print values. It turns out that functions can also do both.

def f(x):
print(x+2)
return x+3

u = f(5), prints 7 and assigns u to 8
v = f(9), prints 11 and assigns v to 12
print(u+v), prints 20

Function reference variables are alias names for functions that enable a variable to take on the same operation as an existing function.

def a( x , y ):
return y-1

b = a
print( b(8,15) ) prints 14 on the console

0:30 Review of Functions
2:51 Review of Data Types in Functions
5:08 Review of Functions that Print or Return Values
7:39 Review of Nested Functions
10:21 NEW: Functions that Both Print and Return Values
13:32 NEW: Function Reference Variables
15:37 NEW: Docstrings

Thanks for watching, and PLEASE SUBSCRIBE!!!
Рекомендации по теме
join shbcf.ru