Python in easy steps: Makes programming fun by Mike McGrath

Python in easy steps: Makes programming fun by Mike McGrath

Author:Mike McGrath [McGrath, Mike]
Language: eng
Format: epub, mobi, pdf
ISBN: 9781840785968
Publisher: In Easy Steps Ltd
Published: 2015-02-14T22:00:00+00:00


The argument to the sleep() method may be a floating point number to indicate a more precise sleep pause time.

Next, initialize a variable with a floating point number that is the current elapsed time now since the Epoch

end_timer = time()

Now, initialize a variable with the rounded seconds value of the time difference between the two timed points

difference = round( end_timer - start_timer )

Finally, add a statement to display the time taken to execute the countdown loop

print( ‘\nRuntime:’ , difference , ‘Seconds’ )

Save the file in your scripts directory then open a Command Prompt window there and run this program – to see the loop pause on each iteration and elapsed time



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.