Dick Moores wrote:
> At 12:12 PM 8/24/2007, Kent Johnson wrote:
>> Dick Moores wrote:
>>> At 10:22 AM 8/24/2007, Kent Johnson wrote:
So you actually pasted that code into timeit.py?
>>> Yeah. :-( I think I learned on the Tutor list to do it that way, but
>>> I'm not sure. Thanks for showing m
Dick Moores wrote:
>> Using your exact code, I just got
>> 0.737564690484
>> 1.17399585702
>> Which is the reverse of your result, but on a slower computer.
>
> That result was gotten using Ulipad. Thought I'd try it at my command
> line (several times, of course--I've reported what seemed to be
-Original Message-
>From: Dick Moores <[EMAIL PROTECTED]>
>Sent: Aug 24, 2007 4:30 PM
>To: Python Tutor List
>Subject: Re: [Tutor] A fun puzzle
>
>Dick Moores wrote:
>>At 10:22 AM 8/24/2007, Kent Johnson wrote:
>>>So you actually pasted that cod
Dick Moores wrote:
>At 10:22 AM 8/24/2007, Kent Johnson wrote:
>>So you actually pasted that code into timeit.py?
>Yeah. :-( I think I learned on the Tutor list to do it that way, but
>I'm not sure. Thanks for showing me a correct way.
I hope not!
>>Using timeit more conventionally I get unsurpr
At 12:12 PM 8/24/2007, Kent Johnson wrote:
Dick Moores wrote:
At 10:22 AM 8/24/2007, Kent
Johnson wrote:
So you actually pasted that code
into timeit.py?Yeah. :-( I think I learned on the Tutor list
to do it that way, but I'm not sure. Thanks for showing me a correct
way.
I hope not!
Using timei
Dick Moores wrote:
> At 10:22 AM 8/24/2007, Kent Johnson wrote:
>> So you actually pasted that code into timeit.py?
>
> Yeah. :-( I think I learned on the Tutor list to do it that way, but I'm
> not sure. Thanks for showing me a correct way.
I hope not!
>> Using timeit more conventionally I get
At 10:22 AM 8/24/2007, Kent Johnson wrote:
>Dick Moores wrote:
This time I added "xrange(10, end, 10)" and did the timing using
the template in the timeit module:
template = """
def inner(_it, _timer):
_t0 = _timer()
from itertools import chain
end = 1
Dick Moores wrote:
>>> This time I added "xrange(10, end, 10)" and did the timing using
>>> the template in the timeit module:
>>> template = """
>>> def inner(_it, _timer):
>>> _t0 = _timer()
>>> from itertools import chain
>>> end = 100
>>> for _i in _it:
>>> for
At 11:49 AM 8/23/2007, Kent Johnson wrote:
>Dick Moores wrote:
>>>Two reasons. First, looking up a name that is local to a function
>>>is faster than looking up a global name. To find the value of
>>>'str', the interpreter has to look at the module namespace, then
>>>the built-in namespace. Thes
Dick Moores wrote:
>> Two reasons. First, looking up a name that is local to a function is
>> faster than looking up a global name. To find the value of 'str',
>> the interpreter has to look at the module namespace, then the
>> built-in namespace. These are each dictionary lookups. Local values
At 08:20 AM 8/23/2007, Kent Johnson wrote:
>Dick Moores wrote:
>>At 07:34 PM 8/22/2007, Kent Johnson wrote:
>>>FWIW here is my fastest solution:
>>>
>>>01 from itertools import chain
>>>02 def compute():
>>>03 str_=str; int_=int; slice_=slice(None, None, -1)
>>>04 for x in chain(xrange(1,
Dick Moores wrote:
> At 07:34 PM 8/22/2007, Kent Johnson wrote:
>> FWIW here is my fastest solution:
>>
>> 01 from itertools import chain
>> 02 def compute():
>> 03 str_=str; int_=int; slice_=slice(None, None, -1)
>> 04 for x in chain(xrange(1, 101, 10), xrange(2, 101, 10),
>> 05 x
At 07:34 PM 8/22/2007, Kent Johnson wrote:
>FWIW here is my fastest solution:
>
>01 from itertools import chain
>02 def compute():
>03 str_=str; int_=int; slice_=slice(None, None, -1)
>04 for x in chain(xrange(1, 101, 10), xrange(2, 101, 10),
>05 xrange(3, 101, 10), xrange(4, 1
R. Alan Monroe wrote:
> I wrote a lame, but working script to solve this in a few minutes. A
> fun puzzle.
FWIW here is my fastest solution:
from itertools import chain
def compute():
str_=str; int_=int; slice_=slice(None, None, -1)
for x in chain(xrange(1, 101, 10), xrange(2, 1
On 23/08/07, Ian Witham <[EMAIL PROTECTED]> wrote:
> An interesting sequence! I assumed the next two numbers would be 8799912,
> 9899901
Hmm...
http://www.research.att.com/~njas/sequences/?q=8712%2C+9801%2C+87912%2C+98901%2C+879912%2C+989901&language=english&go=Search
http://mathworld.wolfram.com
R. Alan Monroe wrote:
> I wrote a lame, but working script to solve this in a few minutes. A
> fun puzzle.
>
> http://weblogs.asp.net/jgalloway/archive/2006/11/08/Code-Puzzle-_2300_1-_2D00_-What-numbers-under-one-million-are-divisible-by-their-reverse_3F00_.aspx
>
>
Fun!
for x in xrange(1, 100
On 23/08/07, R. Alan Monroe <[EMAIL PROTECTED]> wrote:
> I wrote a lame, but working script to solve this in a few minutes. A
> fun puzzle.
>
> http://weblogs.asp.net/jgalloway/archive/2006/11/08/Code-Puzzle-_2300_1-_2D00_-What-numbers-under-one-million-are-divisible-by-their-reverse_3F00_.aspx
>>
I wrote a lame, but working script to solve this in a few minutes. A
fun puzzle.
http://weblogs.asp.net/jgalloway/archive/2006/11/08/Code-Puzzle-_2300_1-_2D00_-What-numbers-under-one-million-are-divisible-by-their-reverse_3F00_.aspx
Alan
___
Tutor mai
18 matches
Mail list logo