2 ответов
0
You can use a loop to go through the elements.
https://code.sololearn.com/cCN7FxoSQpRd/?ref=app
0
# List Comprehension:
# ["output" for "item" in "list" if "filter"]
import numpy as np
x = list(np.random.randint(1,100,30))
y = list(np.random.randint(1,100,30))
print('x =',x)
print('y =',y)
print('Similar =',sorted([xy for xy in x and y if xy in x and y]))