Skip to content
Sign upLog in

How do i add a timer to this?

Profile icon

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

You are viewing a single comment. View All
Profile icon

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