You are viewing a single comment's thread. Return to all comments →
I dont think I can make it look cleaner than this.
def timeConversion(s): meridiem = s[-2:].upper() hh, mm, ss = map(int, s[:-2].split(":")) if meridiem == "AM" and hh >= 12: hh -= 12 elif meridiem == "PM" and hh < 12: hh += 12 return f"{hh:02}:{mm:02}:{ss:02}"
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 →
Python 3
I dont think I can make it look cleaner than this.