Set .intersection() Operation

Sort by

recency

|

466 Discussions

|

  • + 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)))

  • + 0 comments
    n=int(input())
    n_roll=set(map(int,input().split()))
    b=int(input())
    b_roll=set(map(int,input().split()))
    print(len(n_roll&b_roll))