You are viewing a single comment's thread. Return to all comments →
for _ in range(N): command = input().split() if command[0] == 'update': A.update(set(map(int, input().split()))) elif command[0] == 'intersection_update': A.intersection_update(set(map(int, input().split()))) elif command[0] == 'difference_update': A.difference_update(set(map(int, input().split()))) elif command[0] == 'symmetric_difference_update': A.symmetric_difference_update(set(map(int, input().split())))
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 →
for _ in range(N): command = input().split() if command[0] == 'update': A.update(set(map(int, input().split()))) elif command[0] == 'intersection_update': A.intersection_update(set(map(int, input().split()))) elif command[0] == 'difference_update': A.difference_update(set(map(int, input().split()))) elif command[0] == 'symmetric_difference_update': A.symmetric_difference_update(set(map(int, input().split())))
print(sum(A))