The * syntax is for passing a variable number of arguments. Since the function is called with a single argument, a is a list containing a single item: [[1,3,3]] so len(a) is 1.
*
a
[[1,3,3]]
len(a)
Whereas in the second version a is [1,3,3] and len(a) is 3.
[1,3,3]
There's a good explanation of *args and **kwargs on saltycrane.com/blog/2008/01/how-to....
Thanks a lot
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The
*
syntax is for passing a variable number of arguments. Since the function is called with a single argument,a
is a list containing a single item:[[1,3,3]]
solen(a)
is 1.Whereas in the second version
a
is[1,3,3]
andlen(a)
is 3.There's a good explanation of *args and **kwargs on saltycrane.com/blog/2008/01/how-to....
Thanks a lot