You are viewing a single comment's thread. Return to all comments →
Is this code good??
def timeConversion(s): hour = int(s[:2]) minute = s[3:5] second = s[6:8] am_pm = s[8:] if am_pm == "AM": if hour == 12: print(f"0{hour - 12}:{minute}:{second}") else: print(f"0{hour}:{minute}:{second}") elif am_pm == "PM": if hour == 12: print(f"{hour}:{minute}:{second}") else: print(f"{hour + 12}:{minute}:{second}")
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 →
Is this code good??