title: Python 2.7.8 print statement “Syntax Error: invalid syntax” in terminal (ubuntu 14.04) but running well on vim, why?
body: <p><strong>Python 2.7.8 print statement “Syntax Error: invalid syntax”  in terminal(14.04) but running well on vim, why?</strong> </p>
  
  <p>Following program prints the sum of squares, First I try to run this problem on <strong>terminal</strong> it is giving the "<strong>Syntax Error: invalid syntax</strong>" but when copied the same code on <strong>vim</strong> editor and run on terminal <strong>python for.py</strong> (Name of the file is for.py), <strong>It is giving no error</strong>, please explain the reason behind it. </p>
  
  <p><strong>On Running direct on terminal</strong> </p>
  
  <pre><code>Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; squares= [1, 4, 9, 16]
  &gt;&gt;&gt; sum=0
  &gt;&gt;&gt; for num in squares:
  ...     sum+=num
  ... print sum
  
  File "&lt;stdin&gt;", line 3
    print sum
      ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p><strong>On vim</strong> </p>
  
  <pre><code>$ vim for.py
  squares= [1, 4, 9, 16]
  sum=0
  for num in squares:
     sum+=num
  print sum
  </code></pre>
  
  <p><strong>python for.py</strong></p>
  
  <p>output:30 #Running correctly</p>
  
  <p>After suggesting by @mgilson and @ohope5, it working thanks</p>
  
  <pre><code>Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; squares=[1, 4, 9, 16]
  &gt;&gt;&gt; sum=0
  &gt;&gt;&gt; for num in squares:
  ...     sum+=num
  ... 
  &gt;&gt;&gt; print sum
  30
  </code></pre>