Report Bug

Qus

Is the following Python code valid?

>>> a,b=1,2,3
Qusनिम्नलिखित Python कोड वैलिड है?


A. Yes, this is an example of tuple unpacking. a=1 and b=2
B. Yes, this is an example of tuple unpacking. a=(1,2) and b=3
C. No, too many values to unpack
D. Yes, this is an example of tuple unpacking. a=1 and b=(2,3)


Solution
C. No, too many values to unpack



Explanation
For unpacking to happen, the number of values of the right hand side must be equal to the number of variables on the left hand side.
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