from random import randint
list_1 = [0,3,2,5,7,2,3,5,9,2]
list_2 = [1,7,2,5,0,0,2,3,0,4]
list_3 = []
for elem1 in list_1:
for elem2 in list_2:
x = randint(0, 9)
if x != elem1 and x != elem2:
list_3.append(x)
break
print(list_3)
ВЫХОД:
[6, 9, 8, 2, 6, 8, 4, 8, 0, 5]
РЕДАКТИРОВАТЬ:
один вкладыш:
from random import randint
list_1 = [0,3,2,5,7,2,3,5,9,2]
list_2 = [1,7,2,5,0,0,2,3,0,4]
n = 10
print([randint(0, n) for i in list_1 if i in list_2])
ВЫХОД:
[2, 9, 7, 8, 5, 10, 7, 1, 7]