Reputation: 9
I tried to declare a variable 'join', in python, which typically only requires you to name a variable and insert some kind of value for it. When I did so, it said "invalid syntax":
(join = 0.48
returned SyntaxError: invalid syntax
Does anyone know why it won't work?
Upvotes: 0
Views: 71
Reputation: 180522
You cannot set a variable inside a tuple:
In [16]: (join = 0.48)
File "<ipython-input-16-5ecf737095f6>", line 1
(join = 0.48)
^
SyntaxError: invalid syntax
Using:
In [17]: join = 0.48
In [18]: join
Out[18]: 0.48
works fine.
Also join
is a str
method so best avoided as a variable name.
Upvotes: 2