On Thu, Dec 8, 2016 at 1:11 AM, Alan Gauld via Tutor wrote:
> On 08/12/16 06:04, Palanikumar wrote:
>> #Function Argument unpacking
>> def myfunc(x, y, z):
>> print(x. v. z)
>>
>
> Please always send the actual code that generates
> the error, do not retype as it causes us to chase
> phantom
On 08/12/16 06:04, Palanikumar wrote:
> #Function Argument unpacking
> def myfunc(x, y, z):
> print(x. v. z)
>
Please always send the actual code that generates
the error, do not retype as it causes us to chase
phantom bugs. In this case the fact that the v
in the print statement should be a
Palanikumar wrote:
> File "func.py", line 8
> tuple_vec = {1, 0, 1)
> ^
> SyntaxError: invalid syntax
The opening and the closing parenthesis have to match.
To get a tuple:
tuple_vec = (1, 0, 1)
To get a set (with two values in undefined order, so not a good match
#Function Argument unpacking
def myfunc(x, y, z):
print(x. v. z)
tuple_vec = {1, 0, 1)
dict_vec = {'x':1, 'y':0, 'z':1}
myfunc(*tuple_vec)
myfunc(*dict_vec)
It returns following error
File "func.py", line 8
tuple_vec = {1, 0, 1)
^
SyntaxError: invalid syntax