You are viewing a single comment's thread. Return to all comments →
def timeConversion(s): # Write your code here
hh, mm , ss = map(int, s[:-2].split(":")) if s[-2:] == 'AM' and hh == 12: hh = 0 elif s[-2:] == 'PM' and hh != 12: hh+=12 return f"{hh:02}:{mm:02}:{ss:02}"
if name == 'main':
s = input() result = timeConversion(s) print(result)
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Time Conversion
You are viewing a single comment's thread. Return to all comments →
def timeConversion(s): # Write your code here
if name == 'main':