Suppose u and v both denote sets in Python. Under what condition can we guarantee that u|v == u^v ?
![suppose u and v both denote sets in python. under what condition can we guarantee that u|v == u^v?](https://pythonpoint.net/wp-content/uploads/2021/01/suppose-u-and-v-both-denote-sets-in-python.-under-what-condition-can-we-guarantee-that-u_v-u^v_-1024x576.jpg)
Suppose u and v both denote sets in Python. Under what condition can we guarantee that u|v == u^v?
a) The sets u and v should be disjoint.
b) The set v should be a subset of the set u
c) The set u should be a subset of the set v
d) This is true for any u and v.
Answer : a) The sets u and v should be disjoint
For two discrete sets u and v, the |
operator indicates the union. Union of two sets is a set containing all the elements from both two sets. For two sets u and v, ^ is the symmetric difference. It will give a set with elements in either u or v but not both. Therefore, these operators return an equal result if two sets u and v don’t have any common element, i.e, they are disjoint. In other words, they shouldn’t have any intersection.