+ 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
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)
+ 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).
+ 3
The output of any number <=9 must return a leading zero
(13:00 == 01:00)
+ 1
I put in midnight. Does it match the required format?
+ 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
0
No it doesn't
0
I was wondering if there's a function to format the input into that format please
0
You are right Brian