0
How to get a common list from lists in Python ?
I have 2 lists List1 = [1,2,3,4] List2 =[4,5,6,7] The output is list3 =[4]
4 ответов
+ 2
A similar question concerning collections may help.
https://www.sololearn.com/Discuss/1687534/?ref=app
+ 2
Here's a simple answer
list1 = [1, 2, 3, 4]
list2 = [4, 5, 6, 7]
list3 = [i for i in list1 if i in list2]
print(list3)
0
This looks like a homework problem
Kindly show your efforts first
0
David Ashton I see python makes life a lot easier!👍👌