I am trying to understand how this comma separated solution works and how it is called, example:
b, c=0, 5
print(b,c)
>>0 5
- Why is variable 'b' value 0?
- Why is variable 'c' value 5?
I am trying to understand how this comma separated solution works and how it is called, example:
b, c=0, 5
print(b,c)
>>0 5
Comma separated values are interpreted as tuple, which can be unpacked:
t = 0,5 # sames as t = (0,5)
print(type(t))
a,b = t
print(a,b)
Out:
<class 'tuple'>
0 5