Ask coding questions

← Back to all posts
How do i add a timer to this?
TejasvMaheshwar

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

Voters
Leroy01010
TejasvMaheshwar
Comments
hotnewtop
Leroy01010

i have said the answer

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")

Leroy01010

what isn't working

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

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.

NZHacker808

And it is working

TejasvMaheshwar

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

NZHacker808

That's a nice program

VulcanWM

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

TejasvMaheshwar

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

VulcanWM

Maybe you can use threading. @TejasvMaheshwar