About 828,000 results
Open links in new tab
  1. Passing n arguments to a function in Python - Stack Overflow

    Apr 11, 2013 · To pass arguments, you can either pass then one by one: myfunc2(a, b, c) of grouper with * operator: newargs = (a, b, c) myfunc2(*newargs) or using a combination of both …

  2. How to pass multiple arguments to function - GeeksforGeeks

    Jul 3, 2024 · We can pass multiple arguments to a python function without predetermining the formal parameters using the below syntax: def functionName(*argument) The * symbol is used …

  3. Defining Your Own Python Function

    The most straightforward way to pass arguments to a Python function is with positional arguments (also called required arguments). In the function definition, you specify a comma-separated list …

  4. Python Functions - W3Schools

    Information can be passed into functions as arguments. Arguments are specified after the function name, inside the parentheses. You can add as many arguments as you want, just separate …

  5. Accepting any number of arguments to a function - Python

    Nov 18, 2020 · To make a function that accepts any number of arguments, you can use the * operator and then some variable name when defining your function. Some of Python's built-in …

  6. *args and **kwargs in Python - GeeksforGeeks

    Dec 11, 2024 · In Python, *args and **kwargs are used to allow functions to accept an arbitrary number of arguments. These features provide great flexibility when designing functions that …

  7. python - How do I define a function with optional arguments?

    Just use the *args parameter, which allows you to pass as many arguments as you want after your a,b,c. You would have to add some logic to map args -> c,d,e,f but its a "way" of …

  8. Python Function Examples – How to Declare and Invoke with Parameters

    Aug 24, 2021 · This article will show you how to create and call your own Python functions. It will also give you an overview of how to pass input parameters and arguments to your functions. …

  9. Using Python Optional Arguments When Defining Functions

    In this tutorial, you'll learn about Python optional arguments and how to define functions with default values. You'll also learn how to create functions that accept any number of arguments …

  10. Python Function Arguments - PythonHello

    In Python, you can define a function that takes no arguments by simply not including any parameters in the function definition. For example: def greet(): print("Hello, world!") greet() # …

  11. Some results have been removed
Refresh