Mar-28-2019, 08:27 PM
Zip takes two or more sequences, and gives a tuple of the first item from each sequence, then a tuple of the second item from each sequence, and so on:
chars = 'abc' nums = '123' for char, num in zip(chars, nums): print(char + num)
Output:a1
b2
c3
It is the pythonic way to go through two lists together, rather than going by indexes.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures