Set .intersection() Operation

Sort by

recency

|

440 Discussions

|

  • + 0 comments

    n_english=int(input()) rollno_e=set(map(int,input().split()))

    b_french=int(input()) rollno_f=set(map(int,input().split()))

    result=rollno_e.intersection(rollno_f) print(len(result))

  • + 0 comments

    For Python3

    n = int(input())
    english = set(input().split())
    b = int(input())
    french = input().split()
    
    print(len(english.intersection(french)))
    
  • + 0 comments

    input() english_newspaper = set(input().split()) input() french_newspaper = set(input().split())

    print(len(english_newspaper.intersection(french_newspaper)))

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