0 votes
in Python by
Can you please help to clarify what does the *args do in Python Language?

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 Language code to demonstrate

# *args for dynamic arguments

def fn(*argList):  

    for argx in argList:  

        print (argx)

    

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

The output:

I

am

Learning

Python Language

Related questions

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