zip function in python docs code example
Example 1: zip python
>>> x = [1, 2, 3]
>>> y = [4, 5, 6]
>>> zipped = zip(x, y)
>>> list(zipped)
[(1, 4), (2, 5), (3, 6)]
>>> x2, y2 = zip(*zip(x, y))
>>> x == list(x2) and y == list(y2)
True
Example 2: python3 any
# True since 1,3 and 4 (at least one) is true
l = [1, 3, 4, 0]
print(any(l))
# False since both are False
l = [0, False]
print(any(l))
# True since 5 is true
l = [0, False, 5]
print(any(l))
# False since iterable is empty
l = []
print(any(l))