Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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
Source by www.javatpoint.com #
 
PREVIOUS NEXT
Tagged: #Common #elements
ADD COMMENT
Topic
Name
6+7 =