Learn to Code via Tutorials on Repl.it!

← Back to all posts
Learning about using time.sleep() to make your program wait
17prabkann (3)

Use 'import time' to import time function. Then when u need to use it use the line 'time.sleep()' to make the program to wait for specific amount of time. For example:
import time
print("Hello")
time.sleep(3)
print("Make sure that you add a number of seconds to make it actually wait!")

Comments
hotnewtop
AllAwesome497 (399)

Time.sleep is good, but it is bad to use in any web application, since it freezes the entire application instead of a single task. asyncio.sleep pauses a single task only, making it useful (on certain occasions) in web applications.

Jack1562 (0)

I should need this app to control my sleep. Managing your sleep could improve our productivity. For instance, for me is a must to sleep 8 hours per night. If not, I feel dopey even after one espresso. So, sleep is a good ingredient for a healthy brain, first of all. Unfortunately, in the past few weeks, it wasn't possible at all. When I went to Florida for a new project with my Girls from GoIT, I lived in a hotel room with one girl. She snored terribly! I couldn't support her snore at all! My mom warned me about that and prepared me some two snore devices from https://www.chron.com/market/article/best-anti-snoring-devices-16048031.php I was kidding when I took them. I could not predict such things, but she did. My mom is the best!