When you define your function using this syntax:

def someFunc(*args):
    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 other languages) you'd do something like this:

def someFunc(myList = [], *args):
    for x in myList:
        print x

Then you can call it with this:

items = [1,2,3,4,5]

someFunc(items)

You need to define named arguments before variable arguments, and variable arguments before keyword arguments. You can also have this:

def someFunc(arg1, arg2, arg3, *args, **kwargs):
    for x in args
        print x

Which requires at least three arguments, and supports variable numbers of other arguments and keyword arguments.

Answer from g.d.d.c on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › pass-a-list-to-a-function-in-python
Pass a List to a Function in Python - GeeksforGeeks
July 23, 2025 - If we make any modifications to the list, the changes will reflect in the original list. ... This function prints each element of the list l. list l is passed, printing the numbers one by one.
🌐
Medium
nidhiashtikar.medium.com › python-day-25-functions-passing-a-list-6ce7e64abede
Python- Day 25- FUNCTIONS- Passing a List | by Nidhi Ashtikar | Medium
November 13, 2024 - Modifying a list inside a function might remove the original list’s contents, which might need to be preserved. Solution: Pass a copy of the list instead of the original.
Discussions

passing a list as function arguments
You should be using a dictionary and not a list. A dictionary will map keys and values. Dictionaries are written as follows: parameters = { “mode”: “RGBA”, “Prefer_horizontal”: 1 } And then to pass it as an argument you use **parameters in the function definition instead of *parameters. You do not need the “**” when calling the function, only in the function definition. To access the value associated with a key in the dictionary you will do as follows: value = parameters[mode] Where value will now be equal to “RGBA”. Hope this helped! More on reddit.com
🌐 r/learnpython
7
2
May 13, 2021
How can I take a list and pass it to a function as if I passed multiple variables?
func(*my_list) This should do the trick More on reddit.com
🌐 r/learnpython
25
83
March 21, 2021
Aren't lists pass by reference in Python?
No, they aren't. Read this . More on reddit.com
🌐 r/learnpython
11
1
October 25, 2021
Is it bad practice to use variables in functions that are not defined in parameters
Yes, you can use variables defined in the global scope also within functions. You cannot, however, directly use variables defined inside of a main function inside other functions, unless those functions themselves are defined locally inside that main function. In general, you can access variables from all scopes that surround the function definition (provided they are not shadowed by a variable of the same name that's more local), and that's how most programming languages work. In Python, it's constrained by default to reading accesses, but you can also assign to such variables via the use of the global and nonlocal keywords. Some examples: a = 1 # Defined in global scope def test(): print(a) # Local access to global variable def outer(): b = 2 def inner(): print(b) # Reading access to variable in surrounding function scope. def assign(): global a # Required, otherwise below assignment creates a new local variable instead a = 3 # Assigning to global variable The use of global variables within functions is considered bad practice, unless they are constants. Having a global variable with the value of pi, for example, that's then used in calculations within some functions but never changes, is fine. Using global variables to emulate parameters and return values or otherwise using it to share state between functions is usually very much frowned upon. Hence, the global and nonlocal keywords are only very rarely used in well written code. More on reddit.com
🌐 r/learnpython
10
2
March 18, 2022
🌐
Delft Stack
delftstack.com › home › howto › python › python pass list to function
How to Pass List to Function in Python | Delft Stack
February 2, 2024 - Understanding the implications ... you can pass the elements of a list as multiple arguments to a function using the asterisk (*) operator....
🌐
YouTube
youtube.com › studysession
Passing Lists To Functions In Python - YouTube
Passing a list to a function in Python is very similar to passing a singular argument to a python function. In this video we pass two lists to a python funct...
Published: January 8, 2021
Views: 20K
🌐
LabEx
labex.io › tutorials › python-how-to-pass-list-as-argument-in-python-421192
How to pass list as argument in Python | LabEx
By understanding these fundamentals, you'll be well-equipped to work with lists in Python, a core skill for data manipulation in LabEx programming environments. def process_list(items): """Basic function to process a list""" for item in items: print(item) ## Example usage fruits = ['apple', 'banana', 'cherry'] process_list(fruits)
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-passing-list-as-an-argumnet
Python - Passing list as an argumnet - GeeksforGeeks
July 23, 2025 - def print_list(a): for item in a: print(item) # Define a list of numbers a = [1, 2, 3, 4, 5, 6] print_list(a) ... When a list is passed to a function, the function can modify the original list since lists are mutable.
🌐
Toppr
toppr.com › guides › computer-science › programming-with-python › lists › lists-as-arguments
Python Passing a Lists as Arguments: Definition and Concepts
May 25, 2021 - In Python, we can easily expand the list, tuple, dictionary as well as we can pass each element to the function as arguments by the addition of * to list or tuple and ** to dictionary while calling function.
🌐
Python Help
pythonhelp.org › python-lists › how-to-pass-a-list-to-a-function-in-python
How to Pass a List to a Function in Python
In this code, we’re passing a list [‘Alice’, ‘Bob’, ‘Charlie’] to the greetings() function. The function will then print out “Hello, Alice”, “Hello, Bob”, and “Hello, Charlie”. This is a simple demonstration of how you can pass multiple values to a function in Python using a list.
🌐
Delft Stack
delftstack.com › home › howto › python › pass a list to a function in python
How to Pass a List to a Function in Python | Delft Stack
February 2, 2024 - Then, we pass an argument named Cherry while calling the function. This argument goes to the parameter variable flavor, which the function can then use. See the example below. ... Python lists are like any other Python object that we can pass into a function as a simple variable.
🌐
W3Schools
w3schools.com › python › gloss_python_function_passing_list.asp
Python Passing a List as an Argument
Remove List Duplicates Reverse ... Training ... You can send any data types of argument to a function (string, number, list, dictionary etc.), and it will be treated as the same data type inside the function....
🌐
Quora
quora.com › How-do-you-pass-a-list-of-values-to-a-function-in-Python-3-x
How to pass a list of values to a function in Python 3.x - Quora
Answer: That’s easy! [code]def function(variable_a, variable_b): print(variable_a, variable_b) list_of_values = [1, 2] function(*list_of_values) [/code]So, what I did there? I used *(asterisk) to unpack the list of numbers (or any values) into separate parameters. Since, the function accep...
🌐
InformIT
informit.com › articles › article.aspx
5.7 Passing Lists to Functions | How to Sort a List of Tuples in Python | InformIT
Function modify_elements’ items parameter receives a reference to the original list, so the statement in the loop’s suite modifies each element in the original list object. When you pass a tuple to a function, attempting to modify the tuple’s immutable elements results in a TypeError:
🌐
sqlpey
sqlpey.com › python › top-5-methods-to-pass-lists-into-a-python-function
Top 5 Methods to Pass Lists into a Python Function - sqlpey
November 24, 2024 - A: You can define your function with a list parameter and directly pass the list to it. For example: def my_function(my_list): ... my_function([1, 2, 3]). A: Yes, you can combine fixed parameters, a list, and *args in a single function definition. Just ensure the fixed parameters are first.
🌐
NetworkStatic
networkstatic.net › python-tutorial-functions-and-passing-lists-and-dictionaries-with-simple-examples
Python Tutorial: Functions, Passing Lists, Dictionaries with Simple Examples
May 26, 2013 - Quick refresher on lists, a list holds a number of objects inside of a sequence. A tuple is similar but the difference is a tuple cannot be modified while a list can. Example of a list. ... Now lets pass a list to a function notice I am using the built-in ‘str’ function to convert the list to a string in order to print the whole thing in the function.
🌐
PostNetwork Academy
postnetwork.co › home › passing a list in a function in python
Passing a List in a Function in Python - PostNetwork Academy
March 31, 2021 - Not only variables but a list can also be passed and manipulated in a Python’s function. If you want to read about function read the post User Defined Functions in Python and want to know about list see post List in Python . Further, I will demonstrate how to pass a list as a parameter and will return a list which has cube of passed list’s numbers. def makecubelist(ls): newls=[] for i in ls: newls.append(i**3) return newls ls=[3,4,5,6] res=makecubelist(ls) print(res) See the program and output of the below program.