Answers for "compare content of two list in python"

1

python compare two lists

>>> a = [1, 2, 3, 4, 5]
>>> b = [9, 8, 7, 6, 5]
>>> set(a) & set(b)
{5}
Posted by: Guest on March-06-2022
0

how to compare two lists element by element in python and return matched element

>>> [i for i, j in zip(a, b) if i == j]
[5]
Posted by: Guest on July-05-2020

Code answers related to "compare content of two list in python"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language