+ 1

What could be the issue with this code on military time

I am trying to convert from a 12 hour format of time to a 24 hour format. I believe my code is working well but I might have missed some logic somewhere consequently my code doesn't pass all the stage of validation in the code coach https://code.sololearn.com/cRRIptVbs6g8/?ref=app

23rd Jan 2023, 9:52 PM
Gemuh Hans
9 ответов
+ 5
So maybe that's one of the answers you need to provide the correct format for. (00:00 is what I wrote and 0:00 was the output)
23rd Jan 2023, 10:54 PM
Ausgrindtube
Ausgrindtube - avatar
+ 5
Gemuh Hans it fails on 12:30 PM with output of 24:30. (It should be 12:30). Also 12:30 AM wrongly comes out as 12:30. (It should be 00:30).
24th Jan 2023, 12:28 AM
Brian
Brian - avatar
+ 3
The output of any number <=9 must return a leading zero (13:00 == 01:00)
24th Jan 2023, 5:54 AM
Abdul rahmon
Abdul rahmon - avatar
+ 1
I put in midnight. Does it match the required format?
23rd Jan 2023, 10:49 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Gemuh Hans as it is now, 12:00AM and 12:00PM are reversed. input 12:00PM it prints 24:00 --> wrong. it should be 12:00. input 12:00AM it prints 12:00 --> wrong it should be 00:00 see my comments under your code. also, no need for this: if':' in time: time = time
25th Jan 2023, 3:34 AM
Bob_Li
Bob_Li - avatar
0
No it doesn't
23rd Jan 2023, 10:52 PM
Gemuh Hans
0
I was wondering if there's a function to format the input into that format please
23rd Jan 2023, 11:01 PM
Gemuh Hans
0
You are right Brian
24th Jan 2023, 12:56 AM
Gemuh Hans