About 170,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 - How do I get ("return") a result (output) from a function?

    We can make a tuple right on the return line; or we can use a dictionary, a namedtuple (Python 2.6+), a types.simpleNamespace (Python 3.3+), a dataclass (Python 3.7+), or some other …

  3. python - It is more efficient to use if-return-return or if-else-return ...

    Feb 8, 2012 · Since the return statement terminates the execution of the current function, the two forms are equivalent (although the second one is arguably more readable than the first). The …

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

    Often in Python, functions which return None are used like void functions in C -- Their purpose is generally to operate on the input arguments in place (unless you're using global data (shudders)).

  5. python - How can I use `return` to get back multiple values from a …

    Jul 4, 2020 · However, I want to use this code as part of a Discord bot. In order for the bot to work properly, I need to return the data to another function that will actually send the message to …

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

  7. python - What is the formal difference between "print" and "return ...

    Dec 11, 2017 · Edit: as pointed by others, if you are in an interactive python shell you see the same effect (the value is printed), but that happens because the shell evaluates expressions …

  8. function - Ignore python multiple return value - Stack Overflow

    Say I have a Python function that returns multiple values in a tuple: def func(): return 1, 2 Is there a nice way to ignore one of the results rather than just assigning to a temporary variabl...

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

    A new Python checker was added to warn about inconsistent-return-statements. A function or a method has inconsistent return statements if it returns both explicit and implicit values ...

  10. python - what is the need to use return 1 or -1 in the end of a ...

    Jul 28, 2020 · 0 Generally, a return statement is used to give a value back to the caller of the function. In your code for instance: you return 1 if the if condition checks out, and return -1 if …