0
What is EOF???
I was making a math application inside my python AI, but while I was coding it, the compiler said there was an "EOF error" when I wrote "operator=input()" https://sololearn.com/compiler-playground/cqr32sM67BPU/?ref=app
2 Respostas
+ 6
yes, Brian is right, Sololearn's input method is not ideal for the interactive style of your code.
Also, null is not not a valid Python keyword. Python use None.
& is a bitwise operator in Python. Perhaps you should use and.
Maybe use try -except to assign default values by catching the EOF errors.
try: num1=input()
except: num1 = ""
try: num2=input()
except: num2 = ""
try: operator=input()
except: operator = ""
then you could delete the three if statements to set the inputs to "".
And finally you should change
if (num1!=null & num2!=null):
to
if(num1!="" and num2!="" and operator!=""):
+ 6
EOF is an End Of File error. In this context it means that it ran into the end of console input. Understand that Sololearn runs your program as a batch job. It is not interactive. You must supply all inputs before the program even runs. EOF occurs if you do not enter enough inputs.