1=> x = [1, 2, 5, 8] 2=> y = [2, 4, 5, 9] 3=> z = [3, 7] 4 5=> x.intersection(y) # x & y 6=> [2, 5] 7 8=> x.intersection(z) # x & z 9=> []
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