The stupidest question ever seen in this newsgroup...

Gabriel Dupuis gdupuis at rocler.qc.ca
Thu Aug 19 07:08:36 CEST 1999


Yeah, I know that it's a shame to ask a question like this one but...

Ok, I just bought "Programming Python" in the hope to learn a superb
programming langage like Python. But the first program that I try from
the book doesn't work!

Here's the source : (as you can see I haven't been into programming for
a while)

#!/usr/bin/python

x = y / 2
while x > 1:
    if y % x == 0:
         print y, 'has factor', x
         break
    x = x - 1
else:
     print y, 'is prime' 

But when I try to run it from my GNU/Linux box I got this error :

Traceback (innermost last):
  File "./factor.py", line 3, in ?
    x = y / 2
NameError: y

Pretty sad huh? I know it's probally something very dumb (don't flame me
please) but I can't simply find the bug and I copied the source from the
book without any alterations...

If somebody could just take 30 secs and look at this I'll appreciate
much more than you can imagine.

Thanks... (and remember kids, there's no stupid question, just stupid
people :< )




More information about the Python-list mailing list