Get an EOF error when trying to get inputs in a variable

I tried to make a variable that had an input value, but I get an EOF error. I don’t see anything wrong with my code though.

weight = input("How heavy is the object? ")

where are you running this? in an IDE or code editor? I think that wherever you’re running it, it doesn’t support input()

runs fine in my terminal & Colab:

>>> weight = input("How heavy is the object? ")
How heavy is the object? 20

In the codecademy editor.

is there a link to the lesson? need a bit more info to go on here…
input() is a built in method in Python3, forward.

This must be the Python 2 track which has had this problem ever since support was withdrawn at the introduction of Learn Python 3.

The input does work if we are fast enough. Run… Click prompt… type quickly… press Enter. Otherwise it times out. Expect the problem in the entire Python 2 track. If one just wants to grasp the concepts, bypass the input() and manually enter a value for the given variable.

1 Like

Yep, I meant to add that above. raw_input() works in Python2.

It would be the conventional usage, but Python 2 has input() as well, with some technical difference. Too long ago to remember the finer details. Python 3 rolled everything into input().

1 Like

Ah, ok. :woman_facepalming:
Thank you for the clarification. :slight_smile:

1 Like