title: How to give input to python console and validate the output programmatically?
body: <p>For this sample program </p>
  
  <pre><code>N = int(raw_input());
  n  = 0;
  sum = 0;
  while n&lt;N:
  
      sum += int(raw_input());
      n+=1;
  
  print sum;  
  </code></pre>
  
  <p>I have a set of testcases, so I need a python program that invokes the above python program, gives input and should validate the output printed in the console.</p>