+ 1
What does that asterisk in line 1 mean?
def foo(a, *b): return a * b c = foo(1 ,2 ,3) print(c) Other than the question mention on the title, I would also like to know why the output is (2, 3) instead of 6?
1 ответ
0
The asterisk means that it will take the remaining items (if any+) in the iterable and save them in b.
In the example above, input is (1,2,3), thus:
a = 1
b = (2,3)
1*(2,3) = (2,3)
Output: (2,3)
I wish you success!