Set .intersection() Operation

Sort by

recency

|

436 Discussions

|

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

    What is wrong with my code?

    n = input() d,a,c,b= n.splitlines() a = set(a.split()) b = set(b.split())

    x = a.intersection(b) l = len(x) print(l)