Python - Create list of three-item tuples with items from each sequence

Introduction

With three arguments, it builds a list of three-item tuples with items from each sequence.

We get an N-ary tuple for N arguments:

Demo

T1, T2, T3 = (1,2,3), (4,5,6), (7,8,9) 
print( T3 )# from  ww  w  .ja va  2 s. com
print( list(zip(T1, T2, T3)) )                   # Three tuples for three arguments

Result

Related Topic