+ 1

help me what is def in python fully plz??

Full of ????

27th Aug 2019, 5:50 PM
Vignesh Vicky Sfc
Vignesh Vicky Sfc - avatar
2 odpowiedzi
+ 3
Def: is the keyword to define a function in python. Example; def add(a,b): return a+b
27th Aug 2019, 5:52 PM
Tom Hammerbacher
Tom Hammerbacher - avatar
0
It defines a block of code, which will be ran only when the function is called. Function definition: def f(args): ~code~ Function call: f(args) Where: f is the function name, function names follow variable naming rules. args is a list of names (parameters), such as (x, y, z). When the function is called, each name should get a corresponding argument (value). And then the parameters can be used as variables in the function code. ~code~ can be just basic code, which will only be normally ran when the function is called. It can include a return statement, which will break the function call and return a value to the place where the function was called.
27th Aug 2019, 9:40 PM
Seb TheS
Seb TheS - avatar