title: Convert 24 hour time into 12 hour time: edX course Basics of Computing and Programming, branching II
body: <p>When I enter a time below 12 hours on this it comes up with an error (converting any time to 12). So 3:15am would become 12:15 am.</p>
  
  <p>Any ideas?</p>
  
  <pre><code>print("Please enter time in 24 hour format:")
  hour_24=int(input("Please write hours in military/24 hour time"))
  minutes=int(input("Please write the minute(s) in minute format"))
  
  if (0 &lt;= hour_24 &lt;= 11):
      period = "am"
      if (hour_24==0):
          hour_12=12
      else: 
          hour_12=hour_24
  else:
      period = "pm"
      if (hour_24==12):
          hour12=12
      else:
          hour12=hour_24-12
  
  print(hour_24, ":", minutes, " is ", hour12, ":", minutes, " ", period, sep="")
  </code></pre>