To add a delay to your Python code you can use the
sleep() function from Python's time module.
import time countdown = [3, 2, 1, 'Go!!!'] for item in countdown: print(item) time.sleep(1)
The sleep module takes a single argument. This can be either an integer for the number of seconds to sleep or a float if you want to have sub-second resolution such as
0.5 of a second,
1.75 seconds and so on. Using the
sleep() function suspends the processing of the thread which uses almost no processing power and allows other processes to run while it sleeps.