title: Python and file input functions
body: <p>Here is the problem I'm struggling with:
  Two files named numbers1.txt and numbers2.txt both have an unknown number of lines, each line consisting of a single positive integer. Write some code that reads a line from one file and then a line from the other file. The two integers are multiplied together and their product is added to a variable  called scalar_product which should be initialized to zero.</p>
  
  <p>Your code should stop when it detects end of file in either file that it is reading.</p>
  
  <p>For example, if the sequence of integers in one file was "9 7 5 18 13 2 22 16" and "4 7 8 2" in the other file, your code would compute:</p>
  
  <p>4*9 + 7*7 + 8*5 + 2*18</p>
  
  <p>and thus store 161 into scalar_product.</p>
  
  <p>Current code:</p>
  
  <pre><code>number1 = open('numbers1.txt', 'r')
  number2 = open('numbers2.txt', 'r')
  scalar_product = 0
  while number1.readline() != '' and number2.readline() != '':
  product = int(number1.readline()) * int(number2.readline())
  scalar_product += product
  number1.close
  number2.close
  </code></pre>