Problem in military time... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Problem in military time...

I am amazed that i am unable to pass all tests while my code is giving correct o/p for all types of input. Stuck for 2 hours but unable to figure out what's going wrong. Please look in to it and tell me ..... https://code.sololearn.com/ceDN50eRQHpa/?ref=app

3rd Jun 2021, 9:14 PM
saurabh
saurabh - avatar
3 Answers
+ 5
All times from 12:00 AM to 9:59 AM are incorrect for their output. Also, as Shadow states 12:00 PM is incorrect 3:45 AM should output; 03:45 not 3:45
3rd Jun 2021, 9:34 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
I always have to look this up, but as far as I know, 12 AM is midnight or 00:00, while 12 PM is midday or 12:00. Your code has them switched, which is probably the reason for the two failed test cases.
3rd Jun 2021, 9:31 PM
Shadow
Shadow - avatar
+ 1
For input => Expected output 12:00 AM => 00:00 1:00 AM => 01:00 12:00 PM => 12:00
3rd Jun 2021, 9:33 PM
Jayakrishna 🇮🇳