Skip to content
Sign upLog in
← Back to Community

Learning about using time.sleep() to make your program wait

Profile icon
17prabkann

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!")

Voters
Profile icon
ANDYLANFRANCO
Profile icon
4035406
Profile icon
RomeoLuvsHer
Profile icon
Ballsaxdemolishi
Profile icon
carson00111
Profile icon
ObiWan152
Profile icon
AllAwesome497
Profile icon
17prabkann
Comments
hotnewtop
Profile icon
AllAwesome497

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.

Profile icon
Jack1562

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!