0
if i declare a list like this:a,b,*c=[9,8,7,6] then why is a=9,b=8 and c=[7,6]
print(a)=9 print(b)=8 print(c)=[7,6]
2 Answers
+ 2
a, *b = (1, 2, 3)
b will become a list (!) with 2 and 3 (because a takes 1 and b gets what's left).
a, *b = (5,)
Here b would become an empty list, because that's what's left - nothing.
+ 1
Because of tuple unpacking.
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2485/