Set Mutations

  • + 0 comments

    ![](# Enter your code here. Read input from STDIN. Print output to STDOUT

    n = int(input())

    set1 = set(map(int,input().split()))

    choice = int(input())

    for _ in range(choice): op1, size = input().split() other_set = set(map(int, input().split()))

    if op1 == 'intersection_update':
        set1.intersection_update(other_set)
    elif op1 == 'update':
        set1.update(other_set)
    elif op1 == 'symmetric_difference_update':
        set1.symmetric_difference_update(other_set)
    elif op1 == 'difference_update':
        set1.difference_update(other_set)
    

    print(sum(set1))https://)