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?
2 Respuestas
+ 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
0
Thanks