Set .union() Operation

Sort by

recency

|

795 Discussions

|

  • + 0 comments
    n=int(input())
    n_space=set(map(int,input().split()))
    b=int(input())
    b_space=set(map(int,input().split()))
    total=[k for k,v in enumerate(n_space.union(b_space),1)]
    print(total[-1])
    
  • + 0 comments

    Language PyPy3 doesn't work for pop, switch to Python 3

  • + 0 comments

    e,n=int(input()), set(input().split())

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

    print(len(n.union(m)))

  • + 0 comments
    # Enter your code here. Read input from STDIN. Print output to STDOUT
    n = input()
    eng = set(map(int,input().split()))
    b = input()
    fren = set(map(int,input().split()))
    print (len(eng | fren))
    
  • + 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.union(set_fre)
    
    print(len(final_set))