
Returning Multiple Values in Python - GeeksforGeeks
May 2, 2023 · In Python, we can return multiple values from a function. Following are different ways 1) Using Object: This is similar to C/C++ and Java, we can create a class (in C, struct) to …
python - Solving Quadratic Equation - Stack Overflow
Mar 14, 2013 · Below is the Program to Solve Quadratic Equation. For Example: Solve x2 + 3x – 4 = 0. This quadratic happens to factor: x2 + 3x – 4 = (x + 4)(x – 1) = 0. we already know that …
Python: Return Multiple Values from a Function - datagy
Oct 29, 2021 · Learn how to use Python to return multiple values from your functions, using tuples, lists, and dictionaries to understand function outputs.
Python Program to Return Multiple Values From a Function
Example 1: Return values using comma def name(): return "John","Armin" # print the tuple with the returned values print(name()) # get the individual items name_1, name_2 = name() …
Python Function Return Multiple Values: A Comprehensive Guide
Mar 19, 2025 · Python's ability to return multiple values from a function provides a powerful and flexible programming feature. By using data types like tuples, lists, and dictionaries, …
Multiple Return Values in Python | Learn X By Example
Python has built-in support for multiple return values. This feature is often used in idiomatic Python, for example, to return both result and error values from a function.
Write a Python Program to Return Multiple Values From a Function …
Apr 26, 2025 · To return multiple values from a function in Python, you need to define the function and use the return statement to return the values as a tuple. Here’s an example: def …
Python function Return Multiple Values [SOLVED] - GoLinuxCloud
Nov 10, 2022 · Python allows you to return multiple values by separating return values with commas. When multiple values are returned this way, they are actually packed into a single …
python - Is it pythonic for a function to return multiple values ...
In python, you can have a function return multiple values. Here's a contrived example: def divide(x, y): quotient = x/y remainder = x % y return quotient, remainder (q, r) = divide(22, 7)
Return multiple values from a function in Python - DEV …
Sep 2, 2021 · In this method, we use Python to return multiple values by simply separating them by commas. Python basically uses a tuple to achieve this. The code to achieve this is as …
- Some results have been removed