+1

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)

1/24/2020 2:45:41 PM

Soumya Sahu

5 Answers

New Answer

+1

Please tell me what is the error in my code

+1

You have the same problem as the one mentioned here: https://www.sololearn.com/discuss/2105377/?ref=app

+1

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

+1

Jayakrishna thank you so much

+1

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....