0

12 hour to 24 hour clock

I want to create it for converting 12hr format to 24hr format but it does not works in the test Military Time https://www.sololearn.com/coach/70?ref=app https://code.sololearn.com/c6vOaoOskr6I/?ref=app

1st Feb 2020, 11:36 AM
Utkarsh Prajapati
Utkarsh Prajapati - avatar
4 Antworten
+ 4
t = input().split() hm = t[0].split(":") h = int(hm[0]) + 12 if t[1] == "PM" else hm[0] print(f"{h:0>2}:{hm[1]}") https://code.sololearn.com/cTjMmDD1Ox1d
2nd Feb 2020, 6:20 AM
David Ashton
David Ashton - avatar
0
Can you specify military time format in your question?
1st Feb 2020, 11:54 AM
The Sylar
1st Feb 2020, 4:55 PM
Utkarsh Prajapati
Utkarsh Prajapati - avatar
0
There is some bug in the code given by sir David Ashton It print 24:50 if I enter 12:50 PM
2nd Feb 2020, 7:23 AM
Utkarsh Prajapati
Utkarsh Prajapati - avatar