[PyAR2] Programming Challenge II - One is the Magic Number

gslindstrom at gmail.com gslindstrom at gmail.com
Tue Oct 28 12:42:48 CET 2008


It's much better to use xrange() -- as you did -- for things like this. If  
you use range(), Python will create a list and then traverse through it. In  
our case, it will make an array with 1,000,000 elements. xrange() creates  
generator which creates the values as they are used. Your program is almost  
identical to mine, though I like Jesse's program in a Perlish sort of way  
(hey, Jesse...no offense intended!!). If I get the chance, I'll run them  
both and evaluate the time/cpu usage.

--greg

On Oct 28, 2008 6:33am, WW <srilyk at gmail.com> wrote:
> That's a little more simplified than mine:

<snip>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/mailman/private/pyar2/attachments/20081028/416cc988/attachment.htm>


More information about the PyAR2 mailing list