About 1,200,000 results
Open links in new tab
  1. python - What is the purpose of the return statement? How is it ...

    What does the return statement do? How should it be used in Python? How does return differ from print? See also Often, people try to use print in a loop inside a function in order to see multiple ...

  2. python - What does 'Return' do exactly, and where and when should I …

    Aug 15, 2018 · The return statement causes your function to exit and hand back a value to its caller. The point of functions, in general, is to take in inputs and return something.

  3. python: return, return None, and no return at all -- is there any ...

    Note that there's a stylistic difference. return None implies to me that the function sometimes has a non- None return value, but at the location of return None, there is no such return value. Writing no return …

  4. Does every Python function have to return at the end?

    Mar 10, 2017 · Long answer: The return statement is not required in Python, and reaching the end of the function's code without a return will make the function automatically return None Additional question: …

  5. what is the difference between return and break in python?

    Mar 4, 2015 · 54 break is used to end a loop prematurely while return is the keyword used to pass back a return value to the caller of the function. If it is used without an argument it simply ends the function …

  6. Is it possible to not return anything from a function in python? (What ...

    A function or a method has inconsistent return statements if it returns both explicit and implicit values ... According to PEP8, if any return statement returns an expression, any return statements where no …

  7. What does the "yield" keyword do in Python? - Stack Overflow

    Oct 24, 2008 · Yield in Python used to create a generator function. Generator function behaves like an iterator, which can be used in loop to retrieve items one at a time. When a generator function is …

  8. How does Python know where the end of a function is?

    How does Python know this isn't a recursive function that calls itself? When the function runs does it just keep going through the program until it finds a return?

  9. python - How do I get ("return") a result (output) from a function? How ...

    Suppose I have a function like: def foo(): x = 'hello world' How do I get the function to return x, in such a way that I can use it as the input for another function or use the variable within...

  10. What is the use of "assert" in Python? - Stack Overflow

    Feb 28, 2011 · Python assert is basically a debugging aid which test condition for internal self-check of your code. Assert makes debugging really easy when your code gets into impossible edge cases.