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, ∼2741🔥, 0💬
Popular Posts:
How To Remove Slashes on Submitted Input Values in PHP? By default, when input values are submitted ...
How To Open Standard Output as a File Handle in PHP? If you want to open the standard output as a fi...
How To Change Text Fonts for Some Parts of a Paragraph? If you want to change text fonts or colors f...
Where can I download the EPUB 2.0 sample book "The Problems of Philosophy" by Lewis Theme? You can f...
How to add request URL Template Parameters to my Azure API operation 2017 version to make it more us...