title: Python invalid literal sort program
body: <p>I am getting "ValueError: invalid literal for int() with base 10: ''" error.
  My specifications:</p>
  
  <ol>
  <li>Your program must generate a random list of integers whose length and range of values will be specified at run time.</li>
  <li>You must show the unsorted list.</li>
  <li>You must show that the list contains the user specified number of entries.</li>
  <li>You must write and demonstrate code to prove that all of the values in the list lie within the range specified by the user. </li>
  <li>You must use your own implementation of insertion sort in order to create a list that contains all of the items in the original list in ascending order.</li>
  <li>You must display the elements of the sorted list as the list is being built.</li>
  <li>You must display the sorted list.</li>
  </ol>
  
  <p>My code</p>
  
  <pre><code>import random
  
  length = input("Input the length of the random list: ")
  temp = input("Input the range of values for the random list (0-n)")
  
  def gen_list(L, T):
      LIST = []
      ranlower = T[0:T.index('-')]
      ranhigher = T[T.index('-')+1:len(T)]
      for num in range(L):
          x = random.randint(int(ranlower),int(ranhigher))
          LIST.append(x)
      tempmax = ranlower
      tempmin = ranhigher
      for i in range (L):
          for t in range (L):
              if LIST[t] &gt; tempmax:
                  tempmax = LIST[t]
              if LIST[t] &lt; tempmin:
                  tempmin = LIST[t]
      print("Unsorted List: ", LIST)
      print("The largest value in the list was: ", tempmax, " with upper bound at ", ranhigher, ".")
      print("The smallest value in the list was: ", tempmin, " with lower bound at ", ranlower, ".")
      print("The random unsorted list has ", L, " items.")
      sort_numbers(LIST)
  
  def sort_numbers(s):
      for i in range(1, len(s)):
          # let's see what values i takes on
          print ("i = ", i)
          val = s[i]
          j = i - 1
          while (j &gt;= 0) and (s[j] &gt; val):
              s[j+1] = s[j]
              j = j - 1
              print (s)
          s[j+1] = val
      print(s)
  
  gen_list(length, temp)
  </code></pre>
  
  <p>This is the full traceback:</p>
  
  <pre><code>Input the length of the random list: 10
  Input the range of values for the random list (0-n)
  10-15
  Traceback (most recent call last):
    File "/private/var/folders/8_/7j1ywj_93vz2626l_f082s9c0000gn/T/Cleanup At Startup/Program 1-437933490.889.py", line 42, in &lt;module&gt;
      gen_list(length, temp)
    File "/private/var/folders/8_/7j1ywj_93vz2626l_f082s9c0000gn/T/Cleanup At Startup/Program 1-437933490.889.py", line 13, in gen_list
      x = random.randint(int(ranlower),int(ranhigher))
  ValueError: invalid literal for int() with base 10: ''
  </code></pre>