Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
divmod + f-strings solution in Clear category for Time Converter (24h to 12h) by Adherent
def time_converter(time):
hours, minutes = map(int, time.split(':'))
switched, new_hours = divmod(hours, 12)
return f"{new_hours or 12}:{minutes:02} {'p.m.' if switched else 'a.m.'}"
Jan. 7, 2020