what are *args and **kwargs in python? How to use them ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what are *args and **kwargs in python? How to use them ?

18th Jun 2020, 2:47 PM
Anvesh
Anvesh - avatar
4 Answers
0
In simple terms, *args is used to represent a list of values. On the other hand **args is used to represent something like a dictionary which holds key value pairs.
18th Jun 2020, 3:31 PM
Avinesh
Avinesh - avatar
18th Jun 2020, 3:34 PM
Gordon
Gordon - avatar
0
In Python, the single-asterisk form of *args can be used as a parameter to send a non-keyworded variable-length argument list to functions and the double asterisk form of **kwargs is used to pass a keyworded, variable-length argument dictionary to a function.  https://code.sololearn.com/cmliS71s7Pys/?ref=app
18th Jun 2020, 7:00 PM
Harimamy Ravalohery
Harimamy Ravalohery - avatar