+ 2

I've been doing the military time challenge and my code works in all cases except one. Can anyone tell me where I went wrong?

https://code.sololearn.com/c89a0fpTSMZ1/?ref=app

6th Mar 2022, 6:58 PM
Tawananyasha Chinoda
Tawananyasha Chinoda - avatar
5 Respostas
+ 3
You did reverse. For 12:00 AM output is 00:00 but giving 12:00 For 12:00 PM output is 12:00 but giving 00:00
6th Mar 2022, 7:56 PM
Jayakrishna 🇮🇳
+ 2
Input : 12:00 AM Required Output : 00:00 Input : 1:00 AM (input may have single digit hr) Required Output : 01:00 Input : 12:00 PM Required Output : 12:00 May one of these cases failing.
6th Mar 2022, 7:17 PM
Jayakrishna 🇮🇳
+ 2
Both of you showed me something I hadn't considered and I fixed it now but it's still not working.
6th Mar 2022, 7:48 PM
Tawananyasha Chinoda
Tawananyasha Chinoda - avatar
+ 1
24:59 isn't a time, that is represented by 00:59 {EDIT: I think you catch 12:xxAM but fail to change it to 00:xx} Your logic is different to how I've seen it done, but otherwise seems ok. How does it handle 1:49? {EDIT: I think your logic fails when there is a single digit hour}
6th Mar 2022, 7:31 PM
HungryTradie
HungryTradie - avatar
+ 1
Thank you very much. Both of you. I have got it now. I did write it in reverse I don't know what I was on that day.
6th Mar 2022, 8:01 PM
Tawananyasha Chinoda
Tawananyasha Chinoda - avatar