Skip to content
← Back to Community
Stopwatch
Profile icon
Crosis

I am creating a program in python and I am wondering how I would implement a stopwatch that would print the amount of time it took to complete the task whenever the program finished.

Answered by JonDoeBeep [earned 5 cycles]
View Answer
Voters
Profile icon
Crosis
Comments
hotnewtop
Profile icon
JonDoeBeep

you could do something along the lines of this:

sw = 1000 while (sw>0): sw=sw-1 print("done")

because it reads like a person, it reads up to down, left to right, and when a while/for loop happens it goes back to the beginning. Therefore, it does not read the code below until finished.

Profile icon
Crosis

@JonDoeBeep Thanks, but I have figured it out. I'll mark your answer as correct as I did something along those lines

Profile icon
JonDoeBeep

@Crosis OK :)