Set Mutations

  • + 0 comments
    n= int(input())
    A= set(map(int, input().split()))
    N= int(input())
    for i in range(N):
        operation, no_of_elements = input().split()
        other_set= set(map(int, input().split()))
        getattr(A,operation)(other_set) # This has now modified set A
    print(sum(A))