Python: using the zip function
Example:
a = [1, 2, 3]
b = ["one", "two", "three"]
The zip function can be used to combine lists.
Solution:
zipped = list(zip(a, b)) # Outputs: [(1, "one"), (2, "two"), (3, "three")]
Example: Solution:Python: using the zip function
The zip function can be used to combine lists.
a = [1, 2, 3]
b = ["one", "two", "three"]
zipped = list(zip(a, b)) # Outputs: [(1, "one"), (2, "two"), (3, "three")]