Skip to content

Instantly share code, notes, and snippets.

@rostyq
Created July 28, 2017 18:27
Show Gist options
  • Save rostyq/9c7465090d3dd7e1e05c1838ae226fa3 to your computer and use it in GitHub Desktop.
Save rostyq/9c7465090d3dd7e1e05c1838ae226fa3 to your computer and use it in GitHub Desktop.
import numpy
def rnd():
return numpy.random.randint(0, 100, numpy.random.randint(10, 30))
a, b = rnd(), rnd()
# a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
# b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
c = [i for i in a if i in b]
c = list(set(c))
print("First array: {0}\nSecond array: {1}\nArray of common items: {2}".format(a, b, c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment