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, ∼2124🔥, 0💬
Popular Posts:
Where to find tutorials on JSON (JavaScript Object Notation) text string format? I want to know how ...
Why I am getting "LNK1104: cannot open file 'MSCOREE.lib'" error when building a C++/CLI program? Vi...
How to search for the first match of a regular expression using re.search()? The re.search() functio...
How to create a navigation file like navigation.xhtml for an EPUB 3.0 book? At least one navigation ...
How to add request body examples to my Azure API operation to make it more user friendly? If you hav...