Need help with the Military Time Challenge | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Need help with the Military Time Challenge

https://www.sololearn.com/coach/70?ref=app I need help with the Military time challenge Here's my code: time=input() time1="" a=0 a=time.find(" ") if time.endswith("AM"): time1=time[:a] elif time.endswith("PM"): if time.startswith("12"): time1=time[:a] else: a=time.find(':') time1=time[0:a] time1=int(time1)+12 time1=str(time1)+time[a:a+3] print(time1) Three of the test case are cleared but the two locked ones are not. Where am I wrong?

6th Apr 2020, 10:40 AM
Vishal Sahu
Vishal Sahu - avatar
2 Answers
+ 1
For input 12:00 AM output should be 00:00 And for all single digit hour value like 9:00 AM output should be 09:00 1:00 AM to 01:00
6th Apr 2020, 10:56 AM
Jayakrishna 🇮🇳
0
Thanks
6th Apr 2020, 10:58 AM
Vishal Sahu
Vishal Sahu - avatar