GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.geeksforgeeks.org — Python return statement - GeeksforGeeks Python return statementLast Updated : 20 Dec, 2025 The return statement is used inside a function to send a value back to the place where the function was called. Once return is executed, the function stops running, and any code written after it is ignored. If no value is returned, Python automatically returns None. This example shows a function that returns a value.
Output 16 Explanation:
Syntax
When the return statement is executed, the function immediately stops running and sends the specified value back to the caller. If no value is mentioned after return, Python automatically returns None.
Returning Multiple ValuesIn Python, a function can return more than one value at a time. These values are automatically grouped into a tuple and can be unpacked into separate variables.
Output 10 20 Explanation:
Returning a List from a FunctionA function can also return collections like lists, which is useful when you want to return multiple related values together.
Output [9, 27] Explanation:
Function Returning Another FunctionIn Python, functions are first-class citizens, meaning you can return a function from another function. This is useful for creating higher-order functions.
Output Hello Explanation:
Comment Explore |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |