Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to unpack the whole list without index them individually python

def get(x, y, z):
    return x + y + z

numbers = [1, 2, 3]

#instead of writing  numbers[0], numbers[1], numbers[2] in get function

print(get(*numbers)) #add an astros before the name of the list

#output >>> 6
 
PREVIOUS NEXT
Tagged: #unpack #list #index #individually #python
ADD COMMENT
Topic
Name
3+7 =