Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Broken Clock by TovarischZhukov
from datetime import datetime, timedelta
def broken_clock(s_time, w_time, e_descr):
tformat="%H:%M:%S"
inf=e_descr.split(" ")
dct_info={"second":1,"seconds":1,"minute":60,"minutes":60,"hour":3600,"hours":3600}
step=int(inf[0])*dct_info[inf[1]]
intime=int(inf[3])*dct_info[inf[4]]
st=step/float(intime)
s_time=datetime.strptime(s_time, tformat)
w_time=datetime.strptime(w_time, tformat)
i=0; c=0
while 1:
d=timedelta(seconds=(i+c)/1)
if s_time+d>=w_time:
if s_time+d>w_time: c-=1
break
i+=st
c+=1
return str((s_time+timedelta(seconds=c)).time())
Feb. 18, 2016