It's not quite clear to me. What are these numbers? See the code! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

It's not quite clear to me. What are these numbers? See the code!

https://code.sololearn.com/cMeePajs479U/?ref=app

2nd Apr 2018, 1:18 PM
Vučko/Вучко/Vuchko
Vučko/Вучко/Vuchko - avatar
2 Answers
+ 3
This are called as arbitrary arguments.When we dont know well in advance the number of parameters to be passes,we use arbitrary arguemnts. first value goes in named_arg ...while rest of the values are wrapped as tuple and passed as *arg.
2nd Apr 2018, 1:51 PM
Mitali
Mitali - avatar
+ 2
In your function call, function(1, 2, 3, 4, 5), arg is set to 1 and 2, 3, 4, 5 represent args... In the function definition * was used to say that the number of elements in args was not yet known. In this case it will be 4 elements.
2nd Apr 2018, 1:31 PM
cyk
cyk - avatar