Skip to content
  • Tutorials
    • c programming
      • libraries
    • c++
    • Linux
    • Python
    • batch programming
    • Technology
  • IDE
  • Tools
find number of common element in two python array 1

find number of common element in two python array

June 16, 2022 by Anurag batra
len([x for x in list1 if x in list2])

Here is what the above code is Doing:
1. We create a list of all the words in list1 that are in list2.
2. We count the number of words in that list.
3. We return that number.

Categories Python Examples
Post navigation
os remove entire folder python
python selenium scroll all down
© MyEduKit - 2022 . All Rights Reserved.