Report Bug

Qus

What will be the output of the following Python code?

>>> a={5,6,7,8}  >>> b={7,8,10,11}  >>> a^b
Qusनिम्नलिखित Python कोड का आउटपुट क्या होगा?


A. {5,6,7,8,10,11}
B. {7,8}
C. Error as unsupported operand type of set data type
D. {5,6,10,11}


Solution
D. {5,6,10,11}



Explanation
^ operator returns a set of elements in set A or set B, but not in both (symmetric difference).
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad