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.
# two options:deftimeConversion(s):fromdatetimeimportdatetimein_time=datetime.strptime(s,"%I:%M:%S%p")out_time=datetime.strftime(in_time,"%H:%M:%S")returnout_timedeftimeConversion(s):ifs[-2:]=='AM':ifs[:2]=='12':res='00'+s[2:-2]else:res=s[:-2]else:ifs[:2]=='12':res='12'+s[2:-2]else:res=f'{int(s[:2])+12}{s[2:-2]}'returnres
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Time Conversion
You are viewing a single comment's thread. Return to all comments →