title: Write positive and negative numbers between 3 text files
body: <p>A file named data.txt contains an unknown number of lines, each consisting of a single integer. Write some code that creates two files, dataplus.txt and dataminus.txt, and copies all the lines of data1.txt that have positive integers to dataplus.txt, and all the lines of data1.txt that have negative integers to dataminus.txt. Zeros are not copied anywhere.</p>
  
  <p>This code is what I have so far. It runs into an execution error and doesn't write anything to the text files.</p>
  
  <pre><code>minus = open('dataminus.txt', 'a')
  plus = open('dataplus.txt', 'a')
  source = open('data.txt', 'r')
  sor = source.readline()
  while sor != '':
      x = int(sor)
      if (x &gt; 0):
          plus.write(x)
      elif (x &lt; 0):
          minus.write(x)
      sor = source.readline()
  source.close()
  minus.close()
  plus.close()
  </code></pre>