Answers for "python asterisk"

2

what happen when we apply * before list in python

Asterisks for unpacking into function call
That print(*fruits) line is passing all of the
items in the fruits list into the print 
function call as separate arguments, without 
us even needing to know how many arguments are in the list.
... Both * and ** can be used multiple times in function calls
Posted by: Guest on June-09-2020
2

mulitplication symbo for unpacking in python

>>> numbers = [2, 1, 3, 4, 7]
>>> more_numbers = [*numbers, 11, 18]
>>> print(*more_numbers, sep=', ')
2, 1, 3, 4, 7, 11, 18
Posted by: Guest on March-07-2020

Python Answers by Framework

Browse Popular Code Answers by Language