Skip to main content
Fixed and improved code formatting
Source Link
Ninjakannon
  • 3.8k
  • 7
  • 55
  • 82

We can also convert time in Human readableinto human-readable time. import time, datetime

import time, datetime start = time.clock()    def num_multi1(max):   result = 0   for num in range(0, 1000):   if ( num % 3 == 0 or num % 5 == 0):   result += num    print "Sum is %d " %result% result num_multi1(1000) end = time.clock() value = end - start timestamp = datetime.datetime.fromtimestamp(value) print timestamp.strftime('%Y-%m-%d %H:%M:%S') 

We can also convert time in Human readable time. import time, datetime

 start = time.clock()  def num_multi1(max): result = 0 for num in range(0, 1000): if ( num % 3 == 0 or num % 5 == 0): result += num print "Sum is %d " %result num_multi1(1000) end = time.clock() value = end - start timestamp = datetime.datetime.fromtimestamp(value) print timestamp.strftime('%Y-%m-%d %H:%M:%S') 

We can also convert time into human-readable time.

import time, datetime start = time.clock()   def num_multi1(max):   result = 0   for num in range(0, 1000):   if (num % 3 == 0 or num % 5 == 0):   result += num    print "Sum is %d " % result num_multi1(1000) end = time.clock() value = end - start timestamp = datetime.datetime.fromtimestamp(value) print timestamp.strftime('%Y-%m-%d %H:%M:%S') 
Source Link

We can also convert time in Human readable time. import time, datetime

 start = time.clock() def num_multi1(max): result = 0 for num in range(0, 1000): if ( num % 3 == 0 or num % 5 == 0): result += num print "Sum is %d " %result num_multi1(1000) end = time.clock() value = end - start timestamp = datetime.datetime.fromtimestamp(value) print timestamp.strftime('%Y-%m-%d %H:%M:%S')