Python Language Defining functions with list arguments Function and Call

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Lists as arguments are just another variable:

def func(myList):
    for item in myList:
        print(item)

and can be passed in the function call itself:

func([1,2,3,5,7])

1
2
3
5
7

Or as a variable:

aList = ['a','b','c','d']
func(aList)

a
b
c
d


Got any Python Language Question?