+2

I can't solve Military Time...

So I think my solution should work, but it fails two cases... Please help... time = input() if time.endswith(" AM"): print(time.replace(" AM", "")) elif time.endswith(" PM"): time = time.replace(" PM", "") time = time.split(":") time = list(map(int, time)) time[0] = time[0] + 12 if time[1] == 0: time[1] = "00" time = list(map(str, time)) time = ":".join(time) print(time) else: time = list(map(str, time)) time = ":".join(time) print(time)

2/11/2020 12:03:54 AM

Diego

2 Answers

New Answer

+2

12:30 PM = 12:30 - not 24:30 12:30 AM = 00:30 - not 12:30 1:30 AM = 01:30 - not 1:30 Format: XX:XX from 00:00 to 23:59

+1

Ooooohh, thanks man