Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- array1 = []
- array2 = []
- newArray = []
- size1 = random.randint(1,100)
- size2 = random.randint(1,100)
- cont = 0
- while cont < size1 :
- cont = cont + 1
- array1.append(random.randint(1,100))
- cont = 0
- while cont < size2 :
- cont = cont + 1
- array2.append(random.randint(1,100))
- print(array1)
- print(array2)
- for elem in array1:
- if elem in array2:
- if not elem in newArray:
- newArray.append(elem)
- print (newArray)
Add Comment
Please, Sign In to add comment