Set .union() Operation

Sort by

recency

|

784 Discussions

|

  • + 0 comments

    n = int(input()) e = set(map(int,input().split())) b = int(input()) f = set(map(int,input().split())) print(len(e.union(f)))

  • + 0 comments

    For Python3 Platform

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

    eng = input() eng_ids = set(map(int, input().split()))

    fr = input() fr_ids = set(map(int, input().split()))

    print(len(eng_ids.union(fr_ids)))

  • + 0 comments
    n=int(input())
    english = set(list(map(int, input().split())))
    b= int(input())
    french= set(list(map(int, input().split())))
    both = english.union(french)
    
    print(len(both))
    
  • + 0 comments
    n = int(input())
    english = set(map(int, input().split()))
    
    b = int(input())
    french = set(map(int, input().split()))
    
    
    diff = english.union(french)
    print(len(diff))