Find the error in this 12 to 24 hour clock

s=input("") l=[int(s[0:2]),s[3:5],s[6:8]] if l[0]==12 and l[2]=="AM": print('00'+":"+l[1]) elif l[0]==12 and l[2]=="PM": print(str(12)+":"+l[1]) elif l[2]=="PM": print(str(l[0]+12)+":"+l[1]) else: if l[0]>9: print(str(l[0])+":"+str(l[1])) else: print('0'+str(l[0])+":"+str(l[1]))

2/11/2020 12:22:34 PM


4 Answers

New Answer


VISHWATEJ Write your code in Sololearn Playground and share here so we can check that what Problem you are facing.


Message me privately As others can cheat from here VISHWATEJ


VISHWATEJ From description: Sample Input: 1:15 PM Sample Output: 13:15 Your code fails on that.


It's working in the playground , but when i write the same code in actual problem , i am getting errors in the hidden test cases