How to Solve NameError: name 'sleep' is not defined -- time

Solution: Import the 'sleep' module

# Add the following line to the top of your code
from time import sleep

 

For more information:
time sleep