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.
deftimeConversion(s):# Write your code herehh=int(s[0:2])mm=s[3:5]ss=s[6:8]period=s[8:9]ifperiod=="P"andhh<12:hh+=12elifperiod=="A"andhh==12:hh=0hour=f"{hh:02d}" if hh<10 else str(hh)returnf"{hour}:{mm}:{ss}"
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 →
A python 3 solution