+ 1
Help with challenge problem
Can someone explain what the letters and asterisk symbol mean in this code: a,b,*c,d=[1,4,3,4,3] print(c[::-1])
2 Answers
+ 3
the list is unpacked into left side respective variables.
a is assinged to 1
b is assinged to 4
d assinged the last value 3
remaining all values from the list assinged into c as a list values
You are printing reverse so output is [4,3]
edit:
For better understandings, use sequence numbers like :
a,b,*c,d=[1,2,3,4,5]
print(c[::-1])
+ 2
a stands for the first number in a list --> 1
b stands for second number ---> 4
c with asterisk means is a list representing fourth and fifth numbers --- > [3,4]
d stands for the last number --> 3