Set .union() Operation

Sort by

recency

|

763 Discussions

|

  • + 0 comments

    i1 = int(input()) l1 = set(input().split()) i2 = int(input()) l2 = set(input().split())

    print(len(l1.union(l2)))

  • + 0 comments

    n = int(input()) students = set(map(int, input().split())) b = int(input()) be = set(map(int, input().split()))

    print(len(students | be))

  • + 0 comments
    n = int(input())
    nE = set(map(int, input().split()))
    
    b = int(input())
    bF = set(map(int, input().split()))
    
    print(len(nE | bF))
    
  • + 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.union(f)))
    
  • + 0 comments

    english = int(input()) english_std = set(list(map(int, input().split()))) france = int(input()) france_std = set(list(map(int, input().split()))) print(len(english_std.union(france_std)))