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

    The Python return statement is a special statement that you can use inside a function or method to send the function’s result back to the caller. A return statement consists of the return keyword followed by an optional return value .

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

    Oct 30, 2024 · In this Python article, you learn everything about the Python return function with multiple examples, such as what happens when you don’t use the return statement. Then, you will see a basic example of the return statement, giving multiple values in the return statement.

  3. Python return statement - GeeksforGeeks

    Dec 10, 2024 · In Python, functions are first-class citizens, meaning you can return a function from another function. This is useful for creating higher-order functions. Here’s an example of a function that returns another function:

  4. 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 functions in our Python Functions Tutorial. Python Keywords.

  5. Python - Return Function from Function - Python Examples

    In this tutorial, we will learn how to return a function and the scenarios where this can be used. 1. A simple example to return a function. In the following program, we define two functions: function1 () and function2 (). function1 () returns function2 () …

  6. What is Python Return Statement? - Python Guides

    Jan 8, 2025 · In this tutorial, I will explain what is Python return statement. As a Python developer working on a project for one of my clients, I often came across a scenario while working on functions to use a return statement.

  7. Return a Function in Python - How-To Guide with Examples

    May 3, 2024 · Returning a function from a function means that a function is created and returned as output of another function. This is possible in Python because functions are first-class objects, which means they can be passed around just like any other object such as …

  8. Python Functions - Python Guides

    What are Functions in Python? A function is a block of organized, reusable code that performs a specific task. Functions help break our program into smaller and modular chunks, making it more organized and manageable. Defining a Function. In Python, you define a function using the def keyword, followed by the function name and parameters in ...

  9. return | Python Keywords – Real Python

    In Python, the return keyword exits a function and returns a value back to the caller. It allows you to send results back from a function so that you can use them elsewhere in your program. If no value is specified, return will return None by default. Here’s an example to illustrate how the return keyword is used in Python:

  10. 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 specified condition first is executed.

Refresh