Games of chance python 3

Can some one explain why this error is shown and what I can do to pass it?

Just sow my shuffle was written wrong, corrected it and still didn’t help…

Hi @roih1994 - welcome to the forum.

I can’t recreate your error, I’m afraid.

It might just be the learning environment (LE) is having an off moment. If you do a “hard” refresh (which I think is Cmd + Option + R in Safari on Mac OS, but I’m not 100% as I’m not a Mac user!) and try again, you might find the problem is fixed.

If that doesn’t work, there’s a troubleshooting guide available.

Thank you ///////////////

The error says that the input returns a End-Of-File(EOF). This is an exception witch has to be caught. It generally happens if the input is empty.

checking if the right input has been given should fix this problem ?
something like:

while user_choise != 'side1' || user_choise != 'side2':
    user_choise = input("choose a side? [side1|side2]: ")

I think this was more commonly the case in Python 2.x, where there was both an input() and a raw_input() function.

2.x input() took input and then attempted to evaluate it as Python code, whereas raw_input() took input and returned it as a string. That behaviour meant that a “blank” input to input() in Python 2.x was an unexpected EOF, with the resulting exception.

With the shift to 3.x, the raw_input() became the new input() function and it always returns a string. The old behaviour of 2.x input() was dropped. This makes it harder, but not impossible I suppose, for the EOFError to be caused by an empty input. (This should just result in input() returning an empty string, "".)

Since @roih1994 has said they’re using Python 3, it’s more likely that the LE had a weird moment whilst running the code which a refresh should fix. :slight_smile:

Did refreshing fix the problem? :slight_smile:

1 Like

For whatever reason, you cannot use input() in the Codecademy Learning Environment. It throws the EOFError when executed:

Run the exact same code on

Click Submit, and then Last >> to finish execution:

My best guess is that it has to do with the console. In some lessons/projects you can type in the console window, but in this one (and many others) you cannot, so there is nowhere to type the input.

You’ll have to hard code your values rather than get user input. You could include lines of code for both, and comment out the unused lines depending on the environment you use to run your code.