Three different algorithms defined as below:
def alg1 (a, b)
  #body
def alg2 (c, d)
  #body
def alg3 (e, f)
  #body
We want the time function to do the following:
def timefunc (s1, s2)
    #Start the clock
    #Call one of your algorithms
    #Stop the clock
    #Print the answer and time it took
I did this but it's not working:
from datetime import datetime 
def timefunc (s1, s2):
   startTime1= datetime.now() 
   alg1(s1, s2)
   timeElapsed1=datetime.now()-startTime1
   print('Time elpased for alg1 '.format(timeElapsed1)) 
   startTime2= datetime.now() 
   alg2(s1,s2)
   timeElapsed2=datetime.now()-startTime2 
   print('Time elpased for alg2 '.format(timeElapsed2)) 
   startTime3= datetime.now() 
   alg3(s1,s2)
   timeElapsed3=datetime.now()-startTime3 
   print('Time elpased for alg3 '.format(timeElapsed3))
Please let me know what I'm doing wrong or if you have a better way of doing this. Thank you.
 
    