Back

Explore Courses Blog Tutorials Interview Questions

Explore Tech Questions and Answers

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

0 votes
2 views
by (1.5k points)
I am a beginner and i am having hard time understanding use of *args and **kwargs. Can anyon please help me in that?

1 Answer

0 votes
by (7.2k points)

*args and **kwargs are special keyword which allows function to take variable length argument. *args passes variable number of non-keyworded arguments list and on which operation of the list can be performed.

1.) *args

The special syntax *args in function definitions in python is used to pass a variable number of arguments to a function. It is used to pass a non-key worded, variable-length argument list. 

2.)**kwargs

The special syntax **kwargs in function definitions in python is used to pass a keyworded, variable-length argument list. We use the name kwargs with the double star. The reason is because the double star allows us to pass through keyword arguments (and any number of them).

Related questions

0 votes
1 answer
asked Jul 26, 2019 in Python by selena (1.6k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...