Hackerrank Time Conversion Solution
This is the solution to the problem found in the Warmup section of algorithm domain in Hackerrank. This program is done using Python 2. In this you are given time in AM/PM format. Convert this into a 24 hour format.
Screenshot
The Code
Found bugs or got anything to share, do comment here !
Screenshot
The Code
x=raw_input() t=x.split(':') if(t[2][2]=='P' or t[2][2]=='p'): if(t[0]!='12'): t[0]=str(12+int(t[0])) elif(t[0]=='12'): t[0]='00' t=':'.join(t) print t[:-2:]
Found bugs or got anything to share, do comment here !
Comments
Post a Comment