0 votes
in Python by
What Does The *Args Do In Python?

1 Answer

0 votes
by
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:

I

am

Learning

Python

Related questions

0 votes
asked Aug 30, 2020 in Python by sharadyadav1986
0 votes
asked Aug 29, 2020 in Python by Robindeniel
...