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