- 2
[ANSWERED] Runtime
How do I measure how long a program runs? --- I got a task to write a word-guessing program. It can just list all the characters, but it is known that the testing program that tests my program uses a word from a file with a certain name. The file is like a dictionary - seems that it is the set of all possible words of my language. So the question is -- which way the test server spends less time guessing the word - if I just list all the chars in alpabethical order or try to pre-guess using the file given?
2 Antworten
+ 2
import datetime
a=datetime.datetime.now()
#run code
print("Time taken",datetime.datetime.now()-a)
- 2
import time
start_time = time.time()
main()
print("--- %s seconds ---" % (time.time() - start_time))