Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
- sys.path.append(pyt_path)
- import random
- list1 = []
- list2 = []
- listLen_1 = random.randint(0,10)
- listLen_2 = random.randint(0,10)
- list1 = [random.randint(0,10) for r in xrange(listLen_1)]
- list2 = [random.randint(0,10) for r in xrange(listLen_2)]
- outlist = []
- #Найдем днинный список и первый цикл организовываем по длинному списку
- if len(list1) >= len(list2):
- longList = list1
- shortList = list2
- else:
- longList = list2
- shortList = list1
- for i in longList:
- checkList = False
- for j in shortList:
- if i == j and i not in outlist: #проверка на дубликаты
- checkList = i
- break
- outlist.append(checkList)
- OUT = outlist, list1, list2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement