On 09Aug2016 20:22, Rob Gaddi <rgaddi@highlandtechnology.invalid> wrote:
Ltc Hotspot wrote:
What is the source of the following,
'error message: SyntaxError: invalid syntax (<string>, line 2)'
v. Python 3.3
Code reads:
x=1
if x==1
# indent 4 spaces
print "x = 1"
A missing colon, the appropriate location of which is left as an
exercise to the reader.
A bit unfair, it is not the most helpful of syntax complaints. Hal: all Python
compound statements (if, while, for, with etc) end in a colon and an indented
"suite" (enclosed chunk of statements). So:
if x == 1:
......
Also, in Python 3 "print" is a function, so:
print("x = 1")
Cheers,
Cameron Simpson <c...@zip.com.au>
--
https://mail.python.org/mailman/listinfo/python-list