Find the error in this 12 to 24 hour clock | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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]))

11th Feb 2020, 12:22 PM
VISHWATEJ
3 Answers
+ 3
VISHWATEJ Write your code in Sololearn Playground and share here so we can check that what Problem you are facing.
11th Feb 2020, 12:27 PM
A͢J
A͢J - avatar
+ 1
VISHWATEJ From description: Sample Input: 1:15 PM Sample Output: 13:15 Your code fails on that.
11th Feb 2020, 12:39 PM
Mihai Apostol
Mihai Apostol - avatar
0
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
11th Feb 2020, 12:29 PM
VISHWATEJ