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
|
792 Discussions
|
Please Login in order to post a comment
With list comprehension:
Without list comprehension:
Can someone tell me please? Where i did mistake? no_of_elements = int(input()) a = set(map(int, input().split())) n = int(input()) for i in range(n): operation = input().split(" ") arr = set(map(int, input().split())) if operation[0] == "intersection_update": a.intersection_update(arr) elif operation[0] == "update": a.update(arr) elif operation[0] == "symmetric_defference_update": a.symmetric_difference_update(arr) else: a.difference_update(arr) print(sum(a))
Can someone help me debug this? I'm getting EOFError for the input of command.