in Python by (31.6k points)
What Does The *Args Do In Python?

1 Answer

0 votes
by (32.2k points)
We use *args as a parameter in the function header. It gives us the ability to pass N (variable) number of arguments.

Please note that this type of argument syntax doesn’t allow passing a named argument to the function.

Example of using the *args:

# Python code to demonstrate

# *args for dynamic arguments

def fn(*argList):  

    for argx in argList:  

        print (argx)


fn('I', 'am', 'Learning', 'Python')

The output:





Related questions

0 votes
asked Aug 30, 2020 in Python by sharadyadav1986 (31.6k points)
0 votes
asked Aug 29, 2020 in Python by Robindeniel (20.8k points)
0 votes
asked Dec 14, 2019 in Python by sharadyadav1986 (31.6k points)