Advertisement
Guest User

Tiempo IF

a guest
Nov 16th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. import datetime
  2. def prueba():
  3.   a=1000
  4.   b=100
  5.   return a>b
  6.  
  7. def prueba2():
  8.   a=1000
  9.   b=100
  10.   valor=False
  11.   if a>b:
  12.     valor=True
  13.   return valor
  14.  
  15. if __name__=="__main__":
  16.   t = datetime.datetime.now()
  17.   for x in range(1000):
  18.       p = prueba()
  19.   tiempo1=datetime.datetime.now()-t
  20.   t = datetime.datetime.now()
  21.   for x in range(1000):
  22.       p = prueba2()
  23.   tiempo2=datetime.datetime.now()-t
  24.   print tiempo1, tiempo2, " - " , tiempo1-tiempo2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement