title: How to input negative numbers into a list
body: <p>I require some help since whenever I input a negative number the list it interprets it as a separate element so once it gets to sorting it puts all the negative symbols at the beginning. The end goal of the code is to sort 2 merged lists without using the default sort functions. Also if there is a better way to get rid of spaces in a list I would appreciate it, since at the moment I have to convert the list to a string and replace/strip the extra elements that the spaces cause.</p>
  
  <pre><code>list1 = list(input())
  list2 = list(input())
  mergelist = list1 + list2
  
  print(mergelist)
  
  
  def bubble_sort(X):
      nums = list(X)
      for i in range(len(X)):
          for j in range(i+1, len(X)):
              if X[j] &lt; X[i]:
                  X[j], X[i] = X[i], X[j]
      return X
  
  mergelist = bubble_sort(mergelist)
  strmergelist = str(mergelist)
  
  strmergelist = strmergelist.replace("'", '')
  strmergelist = strmergelist.replace(",", '')
  strmergelist = strmergelist.strip('[]')
  strmergelist = strmergelist.strip()
  
  print(strmergelist)
  </code></pre>
  
  <p>The output for lists with no negatives is:</p>
  
  <pre><code>1 2 3 4 4 5 5
  </code></pre>
  
  <p>However with negatives it becomes:</p>
  
  <pre><code>- - - - 1 2 3 3 4 4 5
  </code></pre>
  
  <p>and my first print function to just check the merging of the lists looks like this when I input any negatives (ignore the spaces since I attempt to remove them later):</p>
  
  <pre><code>['1', ' ', '-', '2', ' ', '3', '3', ' ', '-', '4', ' ', '-', '4', ' ', '-', '5']
  </code></pre>