This Python DateTime tutorial will teach you how to find the time of calculation. You can find the calculation time using the following code:
# Import the time module
import time
# Get the start time
start_time = time.time()
# Calculate the sum of 1 to 50000000
sum = 0
for i in range(1, 50000001):
sum += i
print(sum)
# Get the end time
end_time = time.time()
# Calculate the total time
total_time = end_time - start_time
# Display the total time
print("Total time in seconds:", str(total_time))Output:
1250000025000000
Total time in seconds: 3.5105507373809814


