0
Military time doubt
Hi, I'm trying to complete the code trainer, and I can't finish the challenge "Military Time". I tried every single possible input (I think) and the output is correct, but there are 2 cases that don't work, and I don't know what to change for the code to work. My code is: hour = input().split(" ") if hour[1] == "PM": morning = False else: morning = True if morning: print(hour[0]) else: hour = hour[0].split(":") hour[0] = str(int(hour[0]) + 12) if hour[0] == "24": hour[0] = "00" print(hour[0] + ":" + hour[1])
5 Respuestas
+ 2
12:15 AM -> 12:15 (should be 00:15)
12:15 PM -> 00:15 (should be 12:15)
+ 2
I'm saying the input of 12:15 AM should return 00:15, not 12:15 as your code outputs.
+ 2
👍
0
That's already covered, after I added 12, obtaining 24, I transformed that 24 to 00
0
Oh god I did it changed!😅 Tysm