How to concatenate two tuples to tuple with pairs of each tuple in Python

2 Answers

0 votes
t1 = (3, 5, 2, 1)
t2 = (8, 9, 99)
 
tt = tuple(zip(t1, t2))
 
print(tt)
 
 
'''
run:
 
((3, 8), (5, 9), (2, 99))
 
'''

 



answered Dec 2, 2019 by avibootz
0 votes
t1 = (3, 5, 2, 1)
t2 = ('a', 'x', 'z')
  
tt = tuple(zip(t1, t2))
  
print(tt)
  
  
'''
run:
  
((3, 'a'), (5, 'x'), (2, 'z'))
  
'''

 



answered Dec 2, 2019 by avibootz
...