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]

26th Apr 2019, 2:08 AM
clovert
clovert - avatar
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.
26th Apr 2019, 2:25 AM
Edwin
Edwin - avatar
26th Apr 2019, 2:58 AM
Diego
Diego - avatar