The *
python operator can sometimes be a bit confusing. It obviously can be used to make a simple product between objects that provide the appropriates magic methods, like int
, float
, str
etc. e.g. 2*4
or 'Hi!'*3
. But the *
operator can also be used to do what's called decomposition, it means it can be used to unpack the values of an iterable. Just to be clear – don't know if it means something to you – it is the python equivalent of javascript's ...
operator.
For example, the following will print a-b-c
.
x = ['a','b','c']
print(*x, sep='-')
For more about the *
operator i'd suggest you to read this