Daniel Nogueira
Posted on January 4, 2023
Short breaks can be fun and functional in some programs. Creating a waiting time before displaying a text, for example, can make the process of using that program more real.
For that, let's import the sleep()
method from the time
module:
from time import sleep
And now just call the sleep()
method specifying the time in seconds:
# 3 second delay
sleep(3)
# 1 minute delay
sleep(60)
Example of how delays can make a program more real:
print('Jo')
sleep(1)
print('Ken')
sleep(1)
print('Po')
sleep(1)
💖 💪 🙅 🚩
Daniel Nogueira
Posted on January 4, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
python Mastering Python’s __name__ and __main__: Understanding Script Execution and Module Imports
November 1, 2024
raspberrypi Controlling an LED with a Snap Using the KY-037 Sound Sensor and Raspberry Pi
October 6, 2024