At Thursday 25/1/2007 01:26, kevin wrote:

Hi... I'm having a few problems here...
I want to input in my function different values and then time each one
to see how long it took to run the function... so right now it doesn't
like the "i" inside my function fibonacci(i)  but if I put a constant
it's fine....

You have to build the right *string* to be evaluated...

for i in (range(1,30)):
        mytime1 = timeit.Timer( 'fibonacci(i)', 'from prl1 import
fibonacci' )

for i in (range(1,30)):
mytime1 = timeit.Timer( 'fibonacci(%d)' % i, 'from prl1 import fibonacci' )


--
Gabriel Genellina
Softlab SRL

        

        
                
__________________________________________________ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to