Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Common elements in a list(comparing two lists.)

list1 = [1,2,3,4,5,6]  
list2 = [7,8,9,2,10]  
for x in list1:  
    for y in list2:  
        if x == y:  
            print("The common element is:",x)

The common element is: 2
Comment

PREVIOUS NEXT
Code Example
Python :: check true false in python 
Python :: geopandas plot raster and vector 
Python :: run c code in python 
Python :: python backtest 
Python :: python zeep- SOAP protocol -WSDL/XSD?XML 
Python :: how to open cmd as administrator with python 
Python :: Get Results From Table Django 
Python :: ValueError: minvalue must be less than or equal to maxvalue 
Python :: database setup in django aws 
Python :: csv python 
Python :: azureservicebus legacy-install-failure 
Python :: linear plot 1D vector for x python 
Python :: how to detect if a key was press down 
Python :: python os module using stat 
Python :: Source code: Matrix Addition using Nested Loop 
Python :: beautifulsoup documentation 
Python :: python import only one function 
Python :: python when to use pandas series, numpy ndarrays or simply python dictionaries 
Python :: integrate label into listbox tkinter 
Python :: sort files in windows order python 
Python :: gym for creating simple grid world 
Python :: vbscript shutdown remote computer 
Python :: can data scientists become software developer 
Python :: mutliple inxed conditions py 
Python :: python write string in multiple lines 
Python :: check it two words are anagram pyhton 
Python :: How to deal with SettingWithCopyWarning in Pandas 
Python :: pandas pivot table margins percentage 
Python :: Python Windows Toggle Caps_Lock 
Python :: dict get keys tcl 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =