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 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz