How to find common numbers from two list using list comprehension in Python

1 Answer

0 votes
lst1 = [1, 2, 3, 4, 6]
lst2 = [2, 3, 4, 5, 7]

lst_common = [a for a in lst1 for b in lst2 if a == b]

print(lst_common) 



'''
run:

[2, 3, 4]
 
'''

 



answered Jul 24, 2019 by avibootz
...