Of course, computing 42**1000000 is not free:

# ------------------
import time

a=time.clock()

N=1000000
42**N

b=time.clock()

print("CPU TIME :", b - a)
# ------------------


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CPU TIME : 2.37

real    0m2.412s
user    0m2.388s
sys     0m0.016s
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So please, explain the following:


# ------------------
import time

a=time.clock()

42**1000000

b=time.clock()

print("CPU TIME :", b - a)
# ------------------

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CPU TIME : 0.0

real    0m2.410s
user    0m2.400s
sys     0m0.008s
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(focus on the CPU TIME!!)
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to