How can I use the sleep function in a python program?

0 votes
Can you give a sample code for practice?
May 23, 2019 in Python by Waseem
• 4,540 points

edited May 24, 2019 by Omkar 107 views

1 answer to this question.

0 votes
You can use sleep as below.

import time

print(" Hello ")

time.sleep(10)

print(" World! ")

When you execute this code first "Hello" will be print and after exactly 10 seconds "World!" will be printed. So by sleep method we can execute events at particular time interval.
answered Jun 9 by anonymous

Related Questions In Python

0 votes
1 answer

How can I use the power function in python 2.7?

print(pow(3,4)) #this will return the exponentiation of 3 ...READ MORE

answered May 20, 2019 in Python by Mohammad
• 3,210 points
129 views
0 votes
1 answer

How can I build a recursive function in python?

I'm wondering whether you meant "recursive". Here ...READ MORE

answered Sep 19, 2018 in Python by Priyaj
• 57,550 points
111 views
0 votes
1 answer

How can I get the count of a list in Python?

len() >>> mylist=[] >>> print len(mylist) 0 READ MORE

answered Dec 12, 2018 in Python by charlie_brown
• 7,780 points
217 views
0 votes
1 answer

How can I lookup hostname using the IP address with a timeout in Python?

Good question. I actually was stuck with ...READ MORE

answered Feb 6, 2019 in Python by Nymeria
• 3,520 points
330 views
0 votes
1 answer

how do I check the length of an array in a python program?

lets say we have a list mylist = ...READ MORE

answered Mar 12, 2019 in Python by Mohammad
• 3,210 points
192 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,183 views
0 votes
0 answers
+4 votes
6 answers