Military time | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Military time

https://code.sololearn.com/c4rh4tx6q7Ey/?ref=app s=input().split(" ") if s[1]=="PM": l=s[0].split(":") n=int(l[0])+12 print((str(n)+":"+l[1])) else: print(s[0])

23rd Jan 2023, 6:07 PM
Sai Teja
Sai Teja - avatar
1 Answer
+ 2
i = input() if i.replace(' PM','') == i: print(i.replace(' AM','')) else: j = i.replace(' PM','').split(':') j[0] = str(int(j[0]) + 12) i = j[0]+':'+j[1] print(i) #Sai Teja here you go I'd it like this
23rd Jan 2023, 6:25 PM
I am offline
I am offline - avatar