Python Program to Check Execution Time of Script or Program

Python Program to Check Execution Time of Script or Program

To check python program execution; In this tutorial, you will learn how to find or check execution time of a simple program or script in python.

The execution time of a program is defined as the time spent by the system to execute a task.

Algorithm to check the execution time of a Sample Python Program/Script:

  • First of all, import the datetime module in your python script/program.
  • Take values from the user.
  • Find the initial time by using now() function and then assign it to a variable which is time_start.
  • Complete the task in the program.
  • Here, we will also find the current time and assign it to a variable which is time_end.
  • To know the execution time simply find the difference between the time_end and time_start i.e time_end – time_start.

Python program to determine the execution time of python script/program

See the following python program to check the execution time of the program or script.

#Python Program to find the execution time of python script

# importing the modules
from datetime import datetime

A=int(input("Enter the A value: "))

B=int(input("Enter the B value: "))

C = A + B

print("A + B = :",C)

e= time_end - time_start

print("The execution time of python program is : ",e)


Enter the A value:  8
Enter the B value:  5
A + B = : 13
The execution time of python program is :  0:00:00.000054

Recommended Python Programs

  1. Python Program to Print ASCII Value of Character
  2. Write a Program to Calculate Simple Interest in Python
  3. Python Program to Compute Compound Interest
  4. Leap Year Program in Python
  5. Python Program to Print Star Pattern
  6. Number Pattern Programs in Python
  7. Python Program to Print Even and Odd numbers From 1 to N
  8. Python Abs() Function: For Absolute Value
  9. How to Check Whether a Number is Fibonacci or Not in Python
  10. Python: Program to Find Power of Number
  11. Python Program to Reverse a Numbers
  12. Python Program to Find Smallest/Minimum of n Numbers
  13. Python Program to Find Largest/Maximum of n Numbers
  14. Python Program to Find The Net Bill Amount After Discount
  15. Python Program to Print Numbers From N to 1 and 1 to N
  16. Python Program to Print Numbers Divisible by 3, 5, 7
  17. Python Program to Print Prime Number 1 to N
  18. How to Find Square of Number in Python
  19. Python Program to Calculate Cube of Number
  20. Python Program to Find LCM of Two Numbers
  21. BMI (Body Mass Index) Calculator in Python
  22. Palindrome Program in Python using while loop, Function, etc
  23. Python: Program to Count Total Number of Bits in Number
  24. Python Random Number Generator Code
  25. Python Program to Calculate n-th term of a Fibonacci Series
  26. Zip Zap Zoom Python Program
  27. Python: program to convert Celsius to Fahrenheit
  28. Python Program to Swap Two Numbers
  29. Python Program to Get Standard Deviation
  30. Python Program to Find the Variance
  31. Python Program to Convert Height in cm to Feet and Inches
  32. Python Program to Convert Meters into Yards, Yards into Meters
  33. Python Program to Convert Kilometers to Meters, Miles
  34. Python Program to Find Perfect Number
  35. Python: Program to Find Strong Number
  36. Python Program Create Basic Calculator
  37. Python Program For math.floor() Method
  38. Python Program to Find Sum of Series 1/1! 2/2! 3/3! …1/n!
  39. Python: Program to Convert Decimal to Binary, Octal and Hexadecimal
  40. Python Program to Find Roots of Quadratic Equation
  41. Python Program to Print Alphabets from A to Z in Uppercase and Lowercase
  42. Python Program to Check Given Input is Alphabet, Number or Special Character
  43. Python Program to Check IF a Number is Power of Another Number
  44. Python Check Binary Representation of Given Number is Palindrome or Not
  45. Python Program to Draw a Pie Chart
  46. Python Program Input the Radius of Circle and Compute the Area


My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published.