from time import time def timer(any_function): def count_time(): start = time() any_function() stop = time() print("%.15f"%(stop-start),'seconds') return return count_time @timerdef hello(): print("Hello World") return @timerdef another_function(): for item in [1,2,3,4,5,6,7,8,9]: print("%d "%item,end='') print() return hello() another_function()
20 December 2017
Example of decorator in pyhon
Subscribe to:
Post Comments (Atom)
-
Suppose you have 24 and you need to find out all divisors of the number. The normally what we do? We just divide the number from 1 to 24. T...
-
#To make a simple gui follow the instructions. You need to at first install PyQt4 in your system. If you use linux run the code sudo apt-ge...
-
It will be easy to solve the problem if you know about the Nim game. " Nim has been mathematically solved for any number of initial...
No comments:
Post a Comment