Help to solve the Military Time challenge with Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help to solve the Military Time challenge with Python

Hey people I’m stuck trying to solve the military to 12h clock conversion challenge. Haven’t code for a long time, I’m a bit rusty on this 😅. So far I have got it to conver 12h to military but the second to last input from the challenge keeps giving the wrong output. I’ve try everything, I think it is something related to the morning time from balls(00:00) to 11:00 or balls to 09:00. I even thought it could’ve been the extra zero in front of the time 01:00 to 09:00 but not really sure cuz I also removed it. Right the time from 01:00 to 09:00 do not have the 0 in front on this code when it come to outputting it. I’m very confuse and have no idea, anything might help. Every suggestion or solution will be helpful. 🙃 https://code.sololearn.com/c4liMEj54F9O/?ref=app

2nd Apr 2020, 2:14 AM
Fabian Nieves
Fabian Nieves - avatar
2 Answers
+ 9
Here's a different approach. h:0>2 adds enough leading zeros to the hours to give it 2 digits https://code.sololearn.com/cTjMmDD1Ox1d
2nd Apr 2020, 3:29 AM
David Ashton
David Ashton - avatar
0
thanks! I’ll do some research on your code. Your solution is very advance and beyond my knowledge on python. David Ashton
2nd Apr 2020, 3:40 AM
Fabian Nieves
Fabian Nieves - avatar