How hard can this be?
Patrick Kirk
pknews at kirks.net
Mon May 21 11:12:44 EDT 2001
if x > 0:
print "x is positive"
You would think anyone could enter that but I can't. I get the following:
>>> import math
>>> if x > 0:
... print "x is positive"
...
Traceback (innermost last):
File "<stdin>", line 1, in ?
NameError: x
>>>
I've tried creating a .py file saying:
if x > 0:
print "x is positive"
and importing it but that doesn't work either.
>>> import a
Traceback (innermost last):
File "<stdin>", line 1, in
File "a.py", line 1
if x > 0:
^
SyntaxError: invalid syntax
The worrying thing is that this is copied directly from the tutorial so I
may well be off to Álan gould's site shortly. But is there something
obvious that I'm missing?
Thanks in advance.
More information about the Python-list
mailing list