While trying to solve this computer olympiad problem, I ran into this error:
Traceback (most recent call last):
File "haybales.py", line 5, in <module>
s = input()
File "<string>", line 0
^
SyntaxError: unexpected EOF while parsing
My current code looks like this:
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'
Are my inputs being read incorrectly? How can I change my code to resolve the error?