Question

I wrote some python code on Talentbuddy's code editor which lead to an EOFError: EOF when reading a line, but I ran the same code on python IDLE and everything is ok. The code is meant to simply sum the number is given by Talenbuddy, but I don't know how to get the number.

def get_sum(a,b):
    c=a+b
    return c
a=raw_input()
b=raw_input()
print get_sum(a,b)

The error is:

Traceback (most recent call last):
File "eval_get_sum.py", line 3, in
from user_file import get_sum
File "/eval/user_file.py", line 4, in
a=raw_input()
EOFError: EOF when reading a line

Was it helpful?

Solution

Assuming this is "Simple Sum", you aren't supposed to be taking any raw_input. When you click "Check Solution", the system will call your function, providing appropriate arguments a and b; you don't have to call it yourself. Remove the last three lines and test again.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top