Set .intersection() Operation

Sort by

recency

|

467 Discussions

|

  • + 0 comments

    n = int(input()) n1=set(map(int,input().split())) m = int(input()) n2=set(map(int,input().split())) print(len(n1 & n2))

  • + 0 comments

    For Python3 Platform

    n = int(input())
    Eng = set(map(int, input().split()))
    b = int(input())
    Frn = set(map(int, input().split()))
    
    print(len(Eng.intersection(Frn)))
    
  • + 0 comments
    e = int(input())
    e_num = set(input().split())
    f = int(input())
    f_num = set(input().split())
    print(len(e_num & f_num))
    
  • + 0 comments
    n = int(input())
    a = set(map(int,input().split()))
    m = int(input())
    b = set(map(int,input().split()))
    print(len(a&b))
    
  • + 0 comments

    N=int(input()) # english newspaper English=set(map(int,input().split()))

    N1=int(input()) # french newspaper French=set(map(int,input().split()))

    '''Common_subscription=English.intersection(French) print(len(Common_subscription))'''

    YOU CAN ALSO USE THIS

    METHOD

    print(len(English.intersection(French)))