Python: Suspend execution of a given script a given number of seconds
Python Operating System Services: Exercise-22 with Solution
Write a Python program that can suspend execution of a given script a given number of seconds.
Python Code :
import time for x in range(4): time.sleep(3) print("Sorry, Slept for 3 seconds...")
Sorry, Slept for 3 seconds... Sorry, Slept for 3 seconds... Sorry, Slept for 3 seconds... Sorry, Slept for 3 seconds...
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to get different time values with components timezone, timezone abbreviations, the offset of the local (non-DST) timezone, DST timezone and time of different timezones.
Next: Write a Python program to convert a given time in seconds since the epoch to a string representing local time.
What is the difficulty level of this exercise?
Test your Python skills with w3resource's quiz
Python: Tips of the Day
Python: Unpack a Tuple
>>> items = (0, 'b', 'one', 10, 11, 'zero') >>> a, b, c, d, e, f = items >>> print(f) zero >>> a, *b, c = items >>> print(b) ['b', 'one', 10, 11] >>> *_, a, b = items >>> print(a) 11
- New Content published on w3resource :
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework