+ 1

Why isn't My military time code working

The code below is my answer to the "military time" code coach problem. It is supposed to take the time in the 12 hour format and convert it to its 24 hour format. I have tested it with many examples and all works. But it didn't pass all the test cases. It passed just 3. So please help me test with your own times and if it doesn't give you the right answer, please tell me. The input should be something like 1:09 PM or 11:09 AM or 8:15 AM or 10:56 PM. https://code.sololearn.com/cMqj4D5pXFc3/?ref=app

17th Dec 2020, 11:17 AM
Sekiro
Sekiro - avatar
7 odpowiedzi
+ 2
And the output should be like : 01:00 or 23:00. I don't remember that code coach much.As I think the input can be 1:09 PM(with gap) but I am not so sure.
17th Dec 2020, 11:46 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
You are right. but if the time is 1:00 AM the output will be 01:00 not 1:00 the output format should be XX:XX.Read the question carefully.
17th Dec 2020, 2:27 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
Zatch bell Thanks a lot man. You were right. I've updated my code and it passed all the tests. Thanks.
17th Dec 2020, 5:16 PM
Sekiro
Sekiro - avatar
+ 1
Welcome my friend.
18th Dec 2020, 4:29 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
Shahed Hasan thanks. I've updated it. It was an oversight. 12:00 AM now reads 00:00 and 12:00 PM now reads 12:00. Thanks for the correction
24th Dec 2020, 8:33 AM
Sekiro
Sekiro - avatar
0
Zatch bell if the time is in AM, it will be as it is. But if it is in PM, then it will be converted to 24 hour time.e.g 1:00 PM will be converted to 13:00 PM. And 9:08 PM will be converted to 21:08 PM
17th Dec 2020, 12:25 PM
Sekiro
Sekiro - avatar