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.
Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad