← Go Back

How to Pause Code Execution for a Certain Time

The time.sleep() standard function takes an integer or floating-point number that indicates the number of seconds to pause program execution.

import time

print("Hello world!")
time.sleep(3)
print("This will print after 3 seconds.")


time