Set Mutations

  • + 0 comments

    Here's my code:

    al = int(input())
    a = set(list(map(int, input().split()))[:al])
    for _ in range(int(input())):
        c, l = input().split()
        if not hasattr(set, c):
            continue
        getattr(a, c)(set(list(map(int, input().split()))[:int(l)]))
    print(sum(a))