We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Sets
- Set Mutations
- Discussions
Set Mutations
Set Mutations
Sort by
recency
|
855 Discussions
|
Please Login in order to post a comment
e = int(input()) e_list = set(list(map(int,input().split()))) op = int(input()) for i in range(0,op): k, num = input().split() if (k == 'intersection_update'): o = set(list(map(int, input().split()))) n = e_list.intersection_update(o) elif (k == 'symmetric_difference_update'): o = set(list(map(int, input().split()))) n = e_list.symmetric_difference_update(o) elif (k == 'difference_update'): o = set(list(map(int, input().split()))) n = e_list.difference_update(o) elif (k == 'update'): o = set(list(map(int, input().split()))) n = e_list.update(o) print(sum(e_list))
For Python3 Platform