Ask coding questions

← Back to all posts
RunTime
Knei (1)

Is there any built-in way to show how long it took to run your code?

Example response:

Run()
Ran!
[Process finished in 0.1 seconds]

Answered by VulcanWM (2769) [earned 5 cycles]
View Answer
Voters
Knei (1)
Comments
hotnewtop
VulcanWM (2769)

Which language?
If Python then you can do the code below:

import datetime
begin_time = datetime.datetime.now()

#whatever function you want to do

runtime = datetime.datetime.now() - begin_time
Knei (1)

@VulcanWM I use python so this works thanks!