About 514,000 results
Open links in new tab
  1. Is it possible to return two lists from a function in python

    Oct 18, 2019 · You can return a tuple of lists, an use sequence unpacking to assign them to two different names when calling the function: return [1, 2, 3], ["a", "b", "c"] You can return as many …

  2. Python - returning multiple values from function to different arrays

    Jan 27, 2014 · assert len(lists) == len(values) for l,v in zip(lists, values): l.append(v) The function zippend takes two parameters. The first is an iterable of List s (what you are referring to as …

  3. Return multiple lists in Python function - Stack Overflow

    def function_returning_multiple_list(): l1=[] l2=[] l3=[] return (l1,l2,l3) def another_fucntion(): list1,list2,list3=function_returning_multiple_list() print list2

  4. Returning Multiple Values in Python - GeeksforGeeks

    May 2, 2023 · To return multiple values from a generator function, you can use the yield keyword to yield each value in turn. The generator function will then pause execution until the next …

  5. Python Return Two or Multiple Lists, Dicts, Arrays ... - Finxter

    Jul 26, 2023 · In summary, there are several methods for returning multiple objects from a Python function, including using tuples and generators with the yield keyword. In this section, we will …

  6. Python Return Multiple Values – How to Return a Tuple, List, or …

    Jul 20, 2020 · You can return multiple values from a function in Python. To do so, return a data structure that contains multiple values, like a list containing the number of miles to run each …

  7. How to Return Multiple Values from a Function in Python?

    Feb 11, 2025 · Learn how to return multiple values from a function in Python using tuples, lists, dictionaries, and `dataclass`. This step-by-step guide includes examples.

  8. Python Function Return Multiple Values: A Comprehensive Guide

    Mar 19, 2025 · While many programming languages allow a function to return only a single value, Python provides a convenient way to return multiple values from a function. This feature can …

  9. Python function Return Multiple Values [SOLVED] - GoLinuxCloud

    Jan 9, 2024 · 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 …

  10. How To Return Multiple Values From a Function in Python?

    Feb 17, 2025 · Learn how to return multiple values in Python using tuples, lists, dictionaries, namedtuples, and more. Explore various methods with practical examples.

  11. Some results have been removed
Refresh