About 1,210,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 …

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

    Aug 15, 2018 · The print() function writes, i.e., "prints", a string in the console. The return statement causes your function to exit and hand back a value to its caller. The point of …

  3. 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 …

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

    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...

  5. 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 …

  6. 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. …

  7. 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?

  8. 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 …

  9. Is it possible to not return anything from a function in python?

    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 …

  10. function - What does return True/False actually do? (Python)

    Feb 14, 2015 · By using a return value, the function does one thing: do the calculation, and the caller can do whatever it wants with it: print it, write it to a database, use it as part of some …