+ 4

This code is of military time(CODE COACH)..in this all tests is not completed..why it is? I m not getting it..

f=input() s=f.split(' ') if s[1]=='AM': print(s[0]) elif s[1]=="PM": z=s[0].split(':') d=int(z[0]) d=d+12 c=str(d)+":"+z[1] print(c)

24th Jan 2020, 2:45 PM
SOUMYA
SOUMYA - avatar
5 ответов
+ 4
Please tell me what is the error in my code
24th Jan 2020, 2:52 PM
SOUMYA
SOUMYA - avatar
+ 4
Jayakrishna thank you so much
24th Jan 2020, 3:17 PM
SOUMYA
SOUMYA - avatar
+ 4
f=input() s=f.split(' ') z=s[0].split(':') if s[1]=='AM': if s[0]=="12:00": print("00:00") elif int(z[0])>9: print(s[0]) else: print("0"+s[0]) elif s[1]=="PM": d=int(z[0]) d=d+12 c=str(d)+":"+z[1] print(c) #Now it works perfectly....
24th Jan 2020, 3:18 PM
SOUMYA
SOUMYA - avatar
+ 2
You have the same problem as the one mentioned here: https://www.sololearn.com/discuss/2105377/?ref=app
24th Jan 2020, 2:54 PM
Diego
Diego - avatar
+ 2
For input 12:00 AM Output should be 00:00 only For input 12:00 PM 0utput should be 12:00 only And also for single digit like input 9:00 AM Output: 09:00
24th Jan 2020, 2:58 PM
Jayakrishna 🇮🇳