title: Inserting a string with time into a fixed-length sorted list of times
body: <p>I have a piece of code, as below, where if a time is less than a value in a list of 5 times I want to insert the new value in the list and delete 5th value in the list, essentially updating the list with the new set of top five times.</p>
  <pre><code>hours=str(input('enter hours:'))
  minutes=int(input('enter minutes:'))
  seconds=int(input('enter seconds:'))
  
  if minutes &lt;10:
      minutes='0'+str(minutes)
  if seconds &lt;10:
      seconds='0'+str(seconds)
      
  currentTime=hours+':'+str(minutes)+':'+str(seconds)
  print(currentTime)
  hours=int(currentTime[0])
  minutes=int(currentTime[2]+currentTime[3])
  seconds=int(currentTime[5]+currentTime[6])
  print(hours, minutes, seconds)
  
  for i in range(1,6):
      aTime=str(Times[0][i])
      print(Times[0][i])
      if hours==int(aTime[1]):
          if minutes==int(aTime[3]+aTime[4]):
              if seconds &lt;=int(aTime[6]+aTime[7]):
                  #equal values deemed quicker
                  print('quicker time than time',str(i))
                  #insert value in Times[0][i]
                  break
          elif minutes&lt;int(aTime[3]+aTime[4]):
              print('quicker time than time',str(i))
              #insert value in Times[0][i]
              break
      elif hours&lt;int(aTime[1]):
          print('quicker time than time',str(i))
          #insert value in Times[0][i]
          break
  </code></pre>
  <p>Example of what I want this to achieve is if;</p>
  <pre><code>Times=['1:30:00','2:00:00','2:00:00','2:00:00','2:00:00']
  </code></pre>
  <p>and, for example, current <code>Time='1:45:00'</code></p>
  <p>That Times should become:</p>
  <pre><code>Times=['1:30:00','1:45:00','2:00:00','2:00:00','2:00:00']
  </code></pre>
  <p>Feel like this type of question has been asked before but couldn't find one.
  Thanks In Advance.</p>
  <p>Side note: I imagine that this is probably a very inefficient way of comparing the times but the method is correct just need to know how to insert a value into a list essentially.</p>