Military time problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Military time problem

First two cases only solve Have you any idea about other three cases. I try this date=input() print(str(int(date[0:2])+12)+date[2:5]) if date[6:8]=="PM" or date[6:8]=="pm" and "00"<=date[0:2]<="11" else print(date[0:5])

12th Apr 2020, 2:32 AM
æshrîth.htm
æshrîth.htm - avatar
2 Answers
+ 3
if hour=="12" and p_day=="AM": print("00:{}".format(minutes)).
12th Apr 2020, 12:55 PM
César Aguas 🇨🇴
César Aguas 🇨🇴 - avatar
0
Also there can be problem like, 1:10 instead of 01:10
12th Apr 2020, 4:34 AM
Varun Vaswani
Varun Vaswani - avatar