+ 3

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)

11th Feb 2020, 12:03 AM
Diego
Diego - avatar
1 Antwort
+ 1
Ooooohh, thanks man
11th Feb 2020, 12:16 AM
Diego
Diego - avatar