Answers for "run time pyrhone"

1

use datetime python to get runtime

from datetime import datetime

start = datetime.now()
# code ...
print(datetime.now()-start)
Posted by: Guest on October-23-2020
-1

check runtime python

import timeit

code = """[4, 2, 3, 1, 5].sort()"""

execution_time = timeit.timeit(code, number=1)

print(execution_time)
Posted by: Guest on November-08-2020

Python Answers by Framework

Browse Popular Code Answers by Language