You are viewing a single comment's thread. Return to all comments →
n = int(input()) a = set(map(int, input().split()))
for _ in range(int(input())): cmd = input().split() command = cmd[0]
if command == "intersection_update": method = set(map(int, input().split())) a.intersection_update(method) elif command == "update": method = set(map(int, input().split())) a.update(method) elif command == "symmetric_difference_update": method = set(map(int, input().split())) a.symmetric_difference_update(method) elif command == "difference_update": method = set(map(int, input().split())) a.difference_update(method)
print(sum(a))
Seems like cookies are disabled on this browser, please enable them to open this website
Set Mutations
You are viewing a single comment's thread. Return to all comments →
n = int(input()) a = set(map(int, input().split()))
for _ in range(int(input())): cmd = input().split() command = cmd[0]
print(sum(a))