Set Mutations

  • + 0 comments

    N = int(input()) a = set(map(int,input().split()))
    b = int(input()) for _ in range(b): operation = input().split() #print(operation) otherset = set(map(int,input().split())) #print(otherset) if len(otherset) == int(operation[1]): if operation[0] == "update": a.update(otherset)
    #print(a) elif operation[0] == "intersection_update": a.intersection_update(otherset) #print(a) elif operation[0] == "difference_update": a.difference_update(otherset) #print(a) elif operation[0] == "symmetric_difference_update": a.symmetric_difference_update(otherset) #print(a) else: print("Plese enter according to the Number") print(sum(a))