Tools, FAQ, Tutorials:
'return' Statement in Function Statement Block
How to use the "return" statement in a function statement block in Python?
✍: FYIcenter.com
The "return" statement can be used in a function statement block to terminate
the execution of the function and return a data object to the calling expression.
Here is a good example of "return" statement used in a function statement block:
>>> def fib(n): ... """Return a Fibonacci series up to n.""" ... out = [] ... a, b = 0, 1 ... while a < n: ... out.append(a) ... a, b = b, a+b ... else: ... return out ... >>> fib(2000) [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597]
⇒ Function Calling Expressions
⇐ 'def' - Function Definition Statements
2018-02-28, ∼2737🔥, 0💬
Popular Posts:
Where to find tutorials on Microsoft Azure services? Here is a large collection of tutorials to answ...
How To Copy Array Values to a List of Variables in PHP? If you want copy all values of an array to a...
How to use the "set-variable" Policy Statement to create custom variables for an Azure API service o...
Where to find EPUB Sample Files? Here is a list of EPUB sample files collected by FYIcenter.com team...
How to Install Docker Desktop 2.5.0 on Windows 10? You can follow this tutorial to Install Docker De...