Advertisement
furas

zip() tuples

Mar 15th, 2017
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. tuple_1 = ('X...', '..X.', 'X..X', '....')
  2. tuple_2 = ('xhwc', 'rsqx', 'xqzz', 'fyzr')
  3.  
  4. result = ''
  5.  
  6. for txt_1, txt_2 in zip(tuple_1, tuple_2):
  7.     for char_1, char_2 in zip(txt_1, txt_2):
  8.         if char_1 == 'X':
  9.             result += char_2
  10.  
  11. print(result) # xqxz
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement