title: convert a user’s speed in kilometers/hour to minutes per kilometer
body: <p>I want to convert a user's speed in km/h and display the time it takes. For example, if a user's input is 15 km/h then it should display 00.04.00 as it takes 4 minutes to run a kilometer with that pace.</p>
  
  <p>I can't really figure out the math. The only thing I've found so far is (distance(1) / km/h(15))/60 gives the correct result of 4. However, if I were to calculate it at 9 km/h the result comes back as 6.66, and I know the time is supposed to be 00:06:40. I just don't know how to convert it correctly. </p>
  
  <p>Sorry for being newbie.</p>
  
  <p>Edit. I was able to solve this with some help. Here's my code</p>
  
  <pre><code>def inputNumber(message):
      while True:
          try:
              user_input = float(input(message))
          except ValueError:
              print("Please enter an appropriate value. For example, 15: ")
              continue
          else:
              return user_input
  
  speed = inputNumber("Enter your running speed in km/h then this program will calculate minutes per kilometer: ")
  while speed &lt; 0:
      speed = inputNumber("Please reenter an appropriate value: ")
  distance = 1  # 1 kilometer
  
  seconds_speed = (distance / speed * 60)*60
  minutes_speed = int((seconds_speed//60))
  print("At that pace you'd run 1 kilometer in",
        minutes_speed,'minutes and',round(seconds_speed % 60),'seconds')
  </code></pre>