0

I got a list named as tower and it contains n number of distinct objects. Wanna pass my list as an argument to a function just as given below.

output = foo([tower[1], tower[2], tower[3]])

How can I iterate through my list and produce this syntax with n number of objects. I really just dont want to type each one of them with commas.

Thanks.

colt.exe
  • 708
  • 8
  • 24
  • 1
    Check the answer in this post: https://stackoverflow.com/questions/6913084/how-to-split-list-and-pass-them-as-separate-parameter – Laure Dec 05 '17 at 08:12
  • 1
    Why not just pass the `tower` array into your function? It looks like you're passing the whole array in there any way. If you want to not include element 0, you can pass in `tower[1:]` Inside the function you can loop over the array with `for i in tower` or something. – swagrov Dec 05 '17 at 08:14

0 Answers0