22nd Jan 2021, 5:29 AM
S. V. Shivaani
S. V. Shivaani - avatar
10 Answers
+ 3
First, Please post your CODE here: Second, You are trying to do the code for just the first 2 test cases that is wrong. The next 3 test cases are always hidden. Many People do this 'mistake'. Don't worry it's fine. I have also done in python like this: t = input().split() hm = t[0].split(":") h = int(hm[0]) + 12 if t[1] == "PM" else hm[0] print(f"{h:0>2}:{hm[1]}") It is not too long. Hope it helps😀
22nd Jan 2021, 6:41 AM
Ezra Bridger 2207 [INACTIVE]
Ezra Bridger 2207 [INACTIVE] - avatar
+ 3
This is my one x=input() lst0=list(x) lst=[] for j in range(0,len(lst0)): if lst0[j].isdigit and lst0[j]!=':' and lst0[j]!=' ' and lst0[j]!="P" and lst0[j]!="A" and lst0[j]!="M": lst+=int(lst0[j]), elif lst0[j]==":" and lst0[j]!=' ': lst+=lst0[j], elif lst0[j]==' ': lst+=lst0[j], elif lst0[j]=="P": lst+=lst0[j], elif lst0[j]=="A": lst+=lst0[j], elif lst0[j]=="M": lst+=lst0[j], if lst[1]!=':' and "P" in lst: if lst[0]==1 and lst[1]<=1 and "P" in lst: lst[0]+=1 lst[1]+=2 lst[5]="" lst[6]="" lst[7]="" elif lst[0]==1 and lst[1]==2 and "P" in lst: lst[5]="" lst[6]="" lst[7]="" elif lst[0]==1 and lst[1]==2 and "P" in lst: lst[5]="" lst[6]="" lst[7]="" elif lst[1]==':' and "P" in lst: if lst[0]<=9 and "P" in lst: lst[0]+=12 lst[4]="" lst[5]="" lst[6]="" elif lst
23rd Jan 2021, 1:52 AM
K.S.S. Karunarathne
K.S.S. Karunarathne - avatar
+ 2
If u will share coach Question link it will not show other users paste your code here or in codebit and sharr link
22nd Jan 2021, 5:52 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
Thank u so much Ezra Bridger 2207 I will try this now
22nd Jan 2021, 6:43 AM
S. V. Shivaani
S. V. Shivaani - avatar
+ 1
Lots and lots of thanks Ezra Bridger 2207 I tried this now it came correct at the same time I have understood the concept also
22nd Jan 2021, 6:46 AM
S. V. Shivaani
S. V. Shivaani - avatar
+ 1
Welcome😊 Keep it up and solve more solutions. It will keep up your spirit and you would test how much you have learned.
22nd Jan 2021, 6:47 AM
Ezra Bridger 2207 [INACTIVE]
Ezra Bridger 2207 [INACTIVE] - avatar
22nd Jan 2021, 6:02 AM
S. V. Shivaani
S. V. Shivaani - avatar
0
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()))
22nd Jan 2021, 6:03 AM
S. V. Shivaani
S. V. Shivaani - avatar
0
This is my code 👆kindly help me to solve
22nd Jan 2021, 6:04 AM
S. V. Shivaani
S. V. Shivaani - avatar
23rd Jan 2021, 5:45 AM
S. V. Shivaani
S. V. Shivaani - avatar