Skip to content
← Back to Community
How do i add a timer to this?
Profile icon
TejasvMaheshwar

Please try to explain in very simple language ....as am a newbie to both coding and python

Voters
Profile icon
JoumanaN
Profile icon
Leroy01010
Profile icon
TejasvMaheshwar
Comments
hotnewtop
Profile icon
Leroy01010

i have said the answer

Profile icon
Leroy01010

you need to import time, then set the time that it started at, and then minus that from the time that it ended (see code below)

import time

timeStart = time.time()
choice = input("Enter choice:\n")
timeEnd= time.time()
timeTaken = timeEnd - timeStart

print("That took: " + str(timeTaken) + "seconds")

Profile icon
Leroy01010

what isn't working

Profile icon
TejasvMaheshwar

I made it work.....there werent any replies for long.....srryy...can you tell me how do i add a timer to this? @Leroy01010

Profile icon
Leroy01010

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. ... Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse.

Profile icon
NZHacker808

And it is working

Profile icon
TejasvMaheshwar

Can you tell me how can i add a timer for every [email protected]

Profile icon
NZHacker808

That's a nice program

Profile icon
VulcanWM

What do you want me to explain? What this program does?

Profile icon
TejasvMaheshwar

Can you tell me how can i add a timer for each [email protected]

Profile icon
VulcanWM

Maybe you can use threading. @TejasvMaheshwar