#itertools.product() Generates the cartesian product of two iterables from itertools import product data1 = [1, 2] data2 = [10, 20] result = product(data1, data2) L = list(result) #turn the iterator into a list print(L)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter