Set .intersection() Operation

Sort by

recency

|

437 Discussions

|

  • + 0 comments

    s=int(input()) set1=set(map(int,input().split(" "))) a= int(input()) set2=set(map(int,input().split(" "))) print(len(set1& set2))

  • + 0 comments

    Here's my code

    el = int(input())
    e = set(list(map(int, input().split()))[:el])
    fl = int(input())
    f = set(list(map(int, input().split()))[:fl])
    print(len(e.intersection(f)))
    
  • + 0 comments

    english = int(input()) english_s = set(list(map(int, input().split()))) france = int(input()) france_s = set(list(map(int, input().split()))) print(len(english_s & france_s))

  • + 0 comments
    n = int(input())
    A = set(input().split())
    b = int(input())
    B = set(input().split())
    print(len(A&B))
    
  • + 0 comments
    n = int(input())
    english = set(map(int, input().split()))
    b = int(input())
    french = set(map(int, input().split()))
    print(len(english.intersection(french)))