daily pastebin goal
8%
SHARE
TWEET

Untitled

IvanBaturin99 Mar 19th, 2018 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # decorator.py ==>
  2.  
  3. import time
  4.  
  5. def timer(f):
  6.     def tmp(*args, **kwargs):
  7.         t = time.time()
  8.         res = f(*args, **kwargs)
  9.         print ("Время выполнения функции: %f" % (time.time()-t))
  10.         return res
  11.  
  12.     return tmp
  13.  
  14. #main.py ==>
  15.  
  16. from decorators import timer
  17.  
  18.  
  19.  
  20. @timer
  21. def Year(start, end):
  22.     while start <= end:
  23.         if ((start % 4 == 0 and start % 100 != 0) or (start % 400 == 0)):
  24.             print("{} visoc".format(start))
  25.         else:
  26.             print("{} ne visoc".format(start))
  27.         start += 1
  28. print(Year(1000,2000))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top