Military time challenge (Python) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Military time challenge (Python)

My code works for all cases but the fourth one. I think it may have something to do with the "XX:XX" format, but when I try to modify the code for the < 10 times, it works just in two cases. I'd appreciate any help :) https://code.sololearn.com/c2apZ4lXLuSm/?ref=app

13th Aug 2021, 3:28 AM
Ricardo Osio
Ricardo Osio - avatar
7 Answers
14th Aug 2021, 6:05 AM
Shadoff
Shadoff - avatar
+ 2
Check if you have 1:35 must be 01:35
13th Aug 2021, 6:44 AM
Shadoff
Shadoff - avatar
+ 1
your problem is around 12:00PM to 12:59PM should convert to 12:00 to 12:59, in military time we start from 00:00(12:00AM) to 23:59 (11:59PM) we dont have 24 in it
13th Aug 2021, 5:41 AM
Mehrdad Sh
Mehrdad Sh - avatar
13th Aug 2021, 5:41 AM
Mehrdad Sh
Mehrdad Sh - avatar
+ 1
Yeah, you need extra zero before single digit as Shadoff mentioned it Shadoff
14th Aug 2021, 2:34 PM
Mehrdad Sh
Mehrdad Sh - avatar
0
Mehrdad Sh Shadoff I modified my code with both of your suggestions and it works fine in the playground, but it still fails the 4th case in the actual challenge. I don't know what's wrong :/ https://code.sololearn.com/c3z1df6hI0V7/?ref=app
14th Aug 2021, 3:24 AM
Ricardo Osio
Ricardo Osio - avatar
0
16th Aug 2021, 1:08 AM
Ricardo Osio
Ricardo Osio - avatar