0
Error Message: EOF Error
Trying to code a calculator from my lesson Please what does the error message mean and how do i resolve it Check valid link below Traceback (most recent call last): File "./Playground/file0.py", line 8, in <module> user_input = input(":") EOFError: EOF when reading a line https://code.sololearn.com/cGvUsbJVPnYB/#py
9 Antworten
+ 2
I added a comment in ur code
Minor prob😊
+ 2
elif user_input == "add":
num1 = float(input("Enter a number:"))
num2 = float(input("Enter another number:"))
result = (num1 + num2)
print("The answer is", result)
break
...
...
else:
print("Unknown input")
break
+ 2
Add brackets to the "input()" and everything will work.
Since you are using a loop, then look carefully at what commands you constantly repeat and try to shorten the code.
+ 1
Instead of placing link to code in the tag area mention the language ,ty
+ 1
And that link took me to this thread only ,weird ,anyway post link to your code using insert code ,
If I could see your code ,it would be easy to find error input looks right to me tho
0
Here is the link
https://code.sololearn.com/cGvUsbJVPnYB/#py
0
You weren't inputting in right format I guess
This is how it should be
add
4
5
Also convert that result to string
Also use break to prevent while loop to keep running and asking input from user
You have to input all the inputs at one time only ,it doesn't let's you give input one by one ,so that's why it was causing end of file error
0
Thanks Vasily, Abhay, Oma Falk
i had to change the user_input on line 8 to this
user_input = input
and i also used "break" to prevent the while loop from running infinitely.
Thanks.
Check the link below for the modified code and tell me what you think
https://code.sololearn.com/cGvUsbJVPnYB/#py
0
EOF stands for End of File in Python. Unexpected EOF implies that the interpreter has reached the end of our program before executing all the code. This error is likely to occur when: we fail to declare a statement for loop ( while / for )