can you overwrite input() variables in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can you overwrite input() variables in python?

my program ask the user to choose an option during each iteration of a while loop until needs are met. however, i reach an eof error after one loop. how can i fix this? example code: player_choice = input()

9th Nov 2021, 2:43 PM
Dasha
Dasha - avatar
2 Answers
+ 3
I'm assuming you're using sololearn's code playground? The code playground doesn't support (real) interactivity. When you run the program a pop-up will ask you for input. Here you have to give all the inputs for the program with each input on a different line. Sololearn then takes the input and the code, sends it to a server where it executes the code, and then displays the output (assuming there is any) as well as any errors that occurred during execution. If you enter less inputs in the pop-up than the code needs sololearn will encounter an EOF error because it keeps looking for input that doesn't come.
9th Nov 2021, 2:56 PM
Simon Sauter
Simon Sauter - avatar
+ 4
Can you please link your code? Without seeing it, it's hard to tell what's happening. Did you try to run your code on SoloLearn? Input works differently here...
9th Nov 2021, 2:56 PM
Lisa
Lisa - avatar