This is the code I have for measuring how long it took the user to complete the program:
start_time = time.time() # Sits at the top of my code print("%f seconds" % (time.time() - start_time)) # Goes at the bottom of my code My question is, how do I round the output of this to one decimal place? For example, if my output was 3.859639 seconds how would I present this like: 3.8 Secounds?
3.9 seconds?round()function: docs.python.org/2/library/functions.html#round. To round down you could subtract 0.5 and thenround()