Set .union() Operation

Sort by

recency

|

800 Discussions

|

  • + 0 comments
    • english=int(input())
    • roll_numbers1 = set(map(int, input().split()))
    • french=int(input())
    • roll_numbers2 = set(map(int, input().split()))
    • both=roll_numbers1.union(roll_numbers2)
    • print(len(both))
  • + 0 comments

    For Python3 Platform

    n = int(input())
    Eng = set(map(int, input().split()))
    b = int(input())
    Frn = set(map(int, input().split()))
    
    print(len(Eng.union(Frn)))
    
  • + 0 comments
    n = int(input())
    set_1 = set(map(int, input().split()))
    
    b = int(input())
    set_2 = set(map(int, input().split()))
    
    print(len(set_1 | set_2))
    
  • + 0 comments

    english_newspaper = int(input()) english_space_separeted = set(map(int, input().split()))

    french_newspaper = int(input()) french_space_separeted = set(map(int, input().split()))

    union_sets = english_space_separeted.union(french_space_separeted)

    print(len(union_sets))

  • + 0 comments
    # Enter your code here. Read input from STDIN. Print output to STDOUT
    m = int(input())
    arr1 = set(map(int,input().split()))
    n = int(input())
    arr2 = set(map(int, input().split()))
    print(len(arr1.union(arr2)))