The stupidest question ever seen in this newsgroup...
Will Ware
wware-nospam at world.std.com
Thu Aug 19 10:36:44 EDT 1999
Gabriel Dupuis (gdupuis at rocler.qc.ca) wrote:
: #!/usr/bin/python
: x = y / 2
: ...other stuff...
: [...NameError...]
Python is complaining that it hasn't heard of a variable called
"y", so when you ask for "y / 2", it can't find it. You could
simply define y like this, _before_ the "x = y / 2" statement:
y = 111298372
But if you do that, you'll need to edit the script every time you
want to factor a new number. So you might want to do something
like this, where you can get the number from the command line:
import sys
y = int(eval(sys.argv[1]))
--
- - - - - - - - - - - - - - - - - - - - - - - -
Resistance is futile. Capacitance is efficacious.
Will Ware email: wware @ world.std.com
More information about the Python-list
mailing list