Aug-06-2020, 07:07 PM
As a newbie, I am trying to understand the assigning multiple values using tuples. May I request one of you to help me here?
2nd piece:
What is happening here exactly?
1 2 3 4 5 6 7 8 9 10 11 |
>>> a = ( 'x' , 'y' , 'z' ) >>> a ( 'x' , 'y' , 'z' ) >>> a = ( 1 , 2 , 3 ) >>> a ( 1 , 2 , 3 ) >>> a = (u,v,z) Traceback (most recent call last): File "<pyshell#26>" , line 1 , in <module> a = (u,v,z) NameError: name 'u' is not defined |
1 2 3 4 5 6 7 8 9 10 11 |
>>> a ( 1 , 2 , 3 ) >>> (u,v,z) = a >>> u 1 >>> v 2 >>> z 3 >>> a ( 1 , 2 , 3 ) |