Created
July 28, 2017 18:27
-
-
Save rostyq/9c7465090d3dd7e1e05c1838ae226fa3 to your computer and use it in GitHub Desktop.
Exercise on www.practicepython.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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