The time module provides a number of functions to deal with dates and the time within a day. It’s a thin layer on top of the C runtime library.
A given date and time can either be represented as a floating point value (the number of seconds since a reference date, usually January 1st, 1970), or as a time tuple.
We will start by using a simple command which adds a time interval between two commands. To start write any two print commands as -
print("hello coders")
print("how are you ?")
after you type these commands run them and as u can see there would be No time interval between them.
So to add a time interval between two commands first of all at top of your program type "import time".
then between those two print commands type -
time.sleep(1)
here 1 indicates 1 second so if you want a 2 second interval type 2 between brackets.
The code looks like this -
here we end our second tutorial of python programming you can even watch this video.
No comments:
Post a Comment