We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#!/bin/python3importmathimportosimportrandomimportreimportsysfromdatetimeimportdatetimefromdatetimeimporttimedelta# Complete the time_delta function below.deftime_delta(t1:str,t2:str)->str:dt1=datetime.strptime(t1,'%a%d%b%Y%H:%M:%S%z')dt2=datetime.strptime(t2,'%a%d%b%Y%H:%M:%S%z')returnstr(int(abs((dt1-dt2).total_seconds())))if__name__=='__main__':fptr=open(os.environ['OUTPUT_PATH'],'w')t=int(input())fort_itrinrange(t):t1=input()t2=input()delta=time_delta(t1,t2)fptr.write(delta+'\n')fptr.close()
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Time Delta
You are viewing a single comment's thread. Return to all comments →