-2

I have a list of lists, and I would like to enter them into a function in such a way that each element of the main list is a different argument to the function.

squares = [[1,5,9,13], [2,6,10,14], [3,7,11,15], [4,8,12,16]]
print zip(squares[0], squares[1], squares[2], squares[3])
# displays [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]

Is there a way to do something like print zip(arguments(squares)) so that the arguments can be entered dynamically?

Mark Karavan
  • 2,592
  • 16
  • 35

1 Answers1

2

This is what the * operator is for:

print zip(*squares)
tzaman
  • 44,771
  • 11
  • 88
  • 112