from datetime import datetime
def time_converter(time):
am = ' a.m.'
pm = ' p.m.'
if "AM" in time:
return time + '{}'.format(am)
else:
return time + '{}'.format(pm)
# not executing and i don't understand, why
parsed_string = datetime.strptime(time, "%H:%M")
formatted_to_twelve = parsed_string.strftime("%I:%M")
if formatted_to_twelve.startswith("0"):
return formatted_to_twelve[len(formatted_to_twelve[0]):]
else:
return formatted_to_twelve
How to make the second "if" statement visible, to be executed? For now, only the first part of this function is executing, and I cannot get, why.
Created at: 2019/07/30 11:14; Updated at: 2019/07/31 16:03
The question is resolved.