0
What is the error? Python language
def convert24(str1): if str1[-2:]=="AM" and str1[:2]=="12": return "00"+str1[2:-4] elif str1 [-2:]=="AM": return str1 [:-2] elif str1[-2:]=="PM" and str1 [:2]=="12": return str1 [:-2] else: return str(int(str1 [:2])+12)+str1[2:6] print(convert24 (input()))
5 Answers
+ 5
Last return statement, last slice should be [2:5] instead of [2:6]:
return str(int(str1 [:2])+12)+str1[2:5]
+ 1
what are you giving as input?
0
Oh OK thank u so much visph
0
It's showing error after I changed to 5 also đąvisph
0
I tried another program for this I came correct visph anyways thanks a lot ya



