About 1,880,000 results
Open links in new tab
  1. How to pass an array to a function in Python - GeeksforGeeks

    Feb 26, 2023 · In this article, we will discuss how an array or list can be passed to a function as a parameter in Python. So for instance, if we have thousands of values stored in an array and …

  2. Declaring a python function with an array parameters and …

    Do you want to pass the whole array/list and operate on it inside the function? Or do you want the same thing done on every value/item in the array/list. If the latter is what you wish I have found …

  3. Passing an array/list into a Python function - Stack Overflow

    Dec 17, 2019 · When you define your function using this syntax: for x in args. print x. You're telling it that you expect a variable number of arguments. If you want to pass in a List (Array from …

  4. Get a list as input from user in Python - GeeksforGeeks

    Dec 5, 2024 · In this article, we will see how to take a list as input from the user using Python. The input() function can be combined with split() to accept multiple elements in a single line and …

  5. How to pass a list as an input of a function in Python

    Feb 1, 2016 · I am using Python, and I have a function which takes a list as the argument. For example, I am using the following syntax, def square(x,result= []): for y in x: …

  6. Passing Arrays/Lists into Python Functions (Python 3)

    May 21, 2024 · def square_array(arr): squared_arr = [] for element in arr: squared_arr.append(element ** 2) return squared_arr my_array = [1, 2, 3, 4, 5] squared_array …

  7. How to pass an array to a function in Python - CodeSpeedy

    Define a function display () that will take an array as an argument and display the elements of the array to the screen. Call the display () function by passing the previously created array as the …

  8. Python Functions - W3Schools

    In Python a function is defined using the def keyword: To call a function, use the function name followed by parenthesis: Information can be passed into functions as arguments. Arguments …

  9. Write Functions with Multiple Parameters in Python

    Jan 28, 2021 · Learn how to write functions that can take multiple as well as optional parameters in Python to eliminate repetition and improve efficiency in your code. A function is a reusable …

  10. How to Define and Call a Function in Python - GeeksforGeeks

    Dec 16, 2024 · By using the word def keyword followed by the function's name and parentheses we can define a function. If the function takes any arguments, they are included inside the …

  11. Some results have been removed
Refresh