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
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
0
Can you specify military time format in your question?
0
Here it is:
https://www.sololearn.com/coach/70?ref=app
0
There is some bug in the code given by sir David Ashton
It print 24:50 if I enter 12:50 PM