"Military Time" challenge is unsolvable. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

"Military Time" challenge is unsolvable.

I've solved the military time challenge, where you convert a 12 hour clock time to a 24 hour one. But because of how this horrendous website was made, it asks for the result to be printed instead of returned like sensible websites do. When you try to test a case, it will only work for one since the printed output can't change per case.

19th Apr 2021, 4:59 AM
Parsec
Parsec - avatar
4 Answers
+ 3
Specify the language and show the code too
19th Apr 2021, 5:13 AM
Atul [Inactive]
+ 2
Possible mistake: Your program should take the input (which is given when testing and which you can see in result), not just a sample input given in a task, and generate input that is based on the given input. About the way SoloLearn wants us to write programs: no matter *how* you wrote your program, the only thing is if the output is correct. The is a big chance that websites that ask to return a value check the *code*, not the *result*, or have a predefined code that outputs/checks the returned value. This is (at least, for me) closer to writing real programs as real projects. Also: if you just return value(s), it is harder to hold multiple values that should be returned, especially if the dynamic output is easier to implement.
19th Apr 2021, 5:28 AM
#0009e7 [get]
#0009e7 [get] - avatar
+ 2
Hi! most likely, you are using direct values for the input data. you shouldn't do that. come up with a universal code that will be suitable for many cases, not just one. show your code and help will be more productive
19th Apr 2021, 5:33 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
how do I separate the AM in a string and leave the digits with a colon?
19th Apr 2021, 6:59 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar