Set .intersection() Operation

Sort by

recency

|

461 Discussions

|

  • + 0 comments

    a,n,b,m=int(input()), set(input().split()), int(input()), set(input().split())

    print(len(n.intersection(m)))

  • + 0 comments
    # Enter your code here. Read input from STDIN. Print output to STDOUT
    n = int(input())
    eng = set(map(int,input().split()))
    b = int(input())
    fren = set(map(int,input().split()))
    print (len(eng.intersection(fren)))
    
  • + 0 comments

    My solution

    e = input("") #English Number
    en = set(input("").split()) #make a set english student
    f = input("") # french number 
    fe = set(input("").split()) # make a set french student
    both = en.intersection((fe)) # set the intersection
    print(len(both)) # How many students are in the both newspaper?
    
  • + 0 comments
    n = int(input())
    set_eng = set(map(int, input().split()))
    
    b = int(input())
    set_fre = set(map(int, input().split()))
    
    final_set = set_eng.intersection(set_fre)
    
    print(len(final_set))
    
  • + 0 comments

    a=input() //If m contains more element than a , It is not occur an error. // this logic only for no of elements not specific no of elements

    m=set([int(i) for i in input().split()]) b=input() n=set([int(i) for i in input().split()]) print(len(m&n))