Syntax error: unexpected EOF while parsing. Am I inputting incorrectly?
<p>While trying to solve <a href="http://www.usaco.org/index.php?page=viewproblem2&amp;cpid=94" rel="nofollow" title="this">this</a> computer olympiad problem, I ran into this error:</p>

<pre><code>Traceback (most recent call last):
File "haybales.py", line 5, in &lt;module&gt;
    s = input()
File "&lt;string&gt;", line 0

^
SyntaxError: unexpected EOF while parsing
</code></pre>

<p>My current code looks like this:</p>

<pre><code>hay = []
s = input()
while s != 'END':
    hay.append(s)
    s = input()

    for i in hay: #adds all integers in array
        var = var + i

       if var % hay[0] == 0:
            average = var / hay[0] #finds average of all numbers in array

            for bale in hay:
                diff = bale - average
                total += diff 
                #finds sum of all differences to find the final answer

             print 'you need to move' + str(total) + 'piles of hay'

        else:
            print 'it\'s not possible to make them equal'
</code></pre>

<p>Are my inputs being read incorrectly?
How can I change my code to resolve the error?</p>

<p>In addition to the fixes suggeted by Andrew Hewitt, the error you see is caused by your use of <code>input</code> instead of <code>raw_input</code> in python2 (in python3 <code>raw_input</code> was renamed to <code>input</code> ). If you check the <a href="https://docs.python.org/2/library/functions.html#input" rel="nofollow">documentation</a> for <code>input</code> you'll see that it expects <strong>valid python code</strong> then tries to run it and returns what ever comes out of it.
<code>raw_input</code> will just put your input in a string and return it.</p>

<p>So just use <code>raw_input</code> and convert manually the string you get to the desired format.</p>

python