About 5,750,000 results
Open links in new tab
  1. The Python return Statement: Usage and Best Practices

    In this step-by-step tutorial, you'll learn how to use the Python return statement when writing functions. Additionally, you'll cover some good programming practices related to the use of …

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

    Effectively, there are two ways: directly and indirectly. The direct way is to return a value from the function, as you tried, and let the calling code use that value. This is normally what you want. …

  3. Python return statement - GeeksforGeeks

    Dec 10, 2024 · Python allows you to return multiple values from a function by returning them as a tuple: Example: In this example, the fun () function returns two values: name and age. The …

  4. Python Return Function [With Examples] - Python Guides

    Oct 30, 2024 · In this Python tutorial, you will learn everything about the Python return function with practical examples and project-based scenarios. While working on a Python Project, I …

  5. Python return Keyword - W3Schools

    The return keyword is to exit a function and return a value. Statements after the return line will not be executed: print("Hello, World!") Define a function using the keyword def. Read more about …

  6. Python return Statement - AskPython

    May 11, 2023 · In Python, the return statement exits a function and returns the specified value to the caller. Multiple return statements may exist in a function, but only the one that fulfils the …

  7. How to use the return statement effectively in Python functions

    In this tutorial, we will explore how to use the return statement effectively in Python functions, covering common scenarios and best practices to help you write more efficient and expressive …

  8. Python Return Statement - Syntax, Usage, and Examples - Mimo

    In Python, the return statement exits a function and passes back a value to the function call. Here's the basic syntax for using return statements: # Function body return return_value. def: …

  9. Mastering the return Statement in Python Functions

    Jan 29, 2025 · Consider the following simple function that calculates the square of a number: result = x * x. return result. In this example, the square function takes an argument x, …

  10. Python Return Statements Explained: What They Are and Why You Use

    Jan 4, 2020 · All functions return a value when called. If a return statement is followed by an expression list, that expression list is evaluated and the value is returned: ... If no expression …

  11. Some results have been removed
Refresh