You are viewing a single comment's thread. Return to all comments →
Python solution
s=input() l=int(s[:2]) ampm=s[8:] if ampm=='PM' and l<12: l+=12 elif ampm=='AM' and l==12: l=0 time='{:02d}'.format(l) ans=time+s[2:8] print(ans)
Seems like cookies are disabled on this browser, please enable them to open this website
Time Conversion
You are viewing a single comment's thread. Return to all comments →
Python solution
s=input() l=int(s[:2]) ampm=s[8:] if ampm=='PM' and l<12: l+=12 elif ampm=='AM' and l==12: l=0 time='{:02d}'.format(l) ans=time+s[2:8] print(ans)