fork(2) download
  1. # your code goes here
  2.  
  3. t = "12/20/2014 15:25:05 pm"
  4.  
  5. hrs = int( t.split()[1][:2] )
  6.  
  7. if hrs > 12:
  8. t = t.replace( str(hrs), str(hrs-12) )
  9. # split() breaks t by spaces. [1] chooses the "15:25:05" part. And [:2] gets the "15"
  10.  
  11. print(t)
Success #stdin #stdout 0.01s 7736KB
stdin
Standard input is empty
stdout
12/20/2014 3:25:05 pm