Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
4-liner: clean with no import solution in Clear category for Time Converter (24h to 12h) by przemyslaw.daniel
def time_converter(str_time):
hours, minutes = map(int, str_time.split(':'))
am_or_pm = ['a.m.', 'p.m.'][hours >= 12]
return f'{(hours-1) % 12+1}:{minutes:02} {am_or_pm}'
Aug. 25, 2018
Comments: