About 854,000 results
Open links in new tab
  1. How to Call Multiple Functions in Python - GeeksforGeeks

    Dec 16, 2024 · In Python, calling multiple functions is a common practice, especially when building modular, organized and maintainable code. In this article, we’ll explore various ways we can call multiple functions in Python.

  2. python - Executing multiple functions simultaneously - Stack Overflow

    May 27, 2022 · This can be done elegantly with Ray, a system that allows you to easily parallelize and distribute your Python code. To parallelize your example, you'd need to define your functions with the @ray.remote decorator, and then invoke them with .remote.

  3. include multiple functions in Python class and object

    To clarify why I want to split the functions: This is just a simplified example. In real work, there are multiple functions needed for different processing steps, and those functions work on different items. You will need to call compute_method_2 at some point, which you're not doing.

  4. Function Composition in Python - GeeksforGeeks

    Mar 3, 2025 · We can modify our utility function to handle multiple functions using Python’s reduce () function from the functools module. Example: Explanation: reduce () applies the compose function across multiple functions sequentially. The execution order is add (5) → sub (7) → mul (6), resulting in 12.

  5. python - How to run multiple functions at the same time

    To parallelize your example, you'd need to define your functions with the @ray.remote decorator, and then invoke them with .remote. # the ray.remote decorator. print("Working") # Execute func1 and func2 in parallel.

  6. Functions in Python – Explained with Code Examples

    Jul 28, 2021 · In this post, we shall see how we can define and use our own functions. Let's get started! The following snippet shows the general syntax to define a function in Python: You need to use the def keyword, give your function a name, followed by a pair of parentheses, and end the line with a colon (:).

  7. 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 hold multiple values and return an object of the class. Below are interesting methods for somebody shifting C++/Java world.

  8. Python Functions: A Comprehensive Guide with Examples

    Mar 17, 2025 · In this blog post, we will explore various examples of functions in Python, understand their usage methods, common practices, and best practices. A function in Python is a block of organized, reusable code that performs a single, related action.

  9. Python Functions - Python Guides

    Real-World Examples. Functions are essential across various Python applications: ... Set Global Variables in Python Functions; Return Multiple Values from a Function in Python; ... Learn about Functions in Python: Create reusable blocks of code using the `def` keyword, pass arguments, return values, and organize your logic efficiently. ...

  10. Python Functions Exercise with Solution [10 Programs] - PYnative

    5 days ago · In Python, we can create a nested function inside a function. We can use the nested function to perform complex tasks multiple times within another function or avoid loop and code duplication. Write a program to create a recursive function to calculate the sum of …

  11. Some results have been removed
Refresh