Guys, please help me fix the error in my simple code. It returns EOF Error. I don't know what it is! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Guys, please help me fix the error in my simple code. It returns EOF Error. I don't know what it is!

https://code.sololearn.com/cvTY4Rhh44qb/?ref=app

23rd May 2020, 10:55 AM
Bunyod Abdusaidov
Bunyod Abdusaidov - avatar
6 Answers
+ 4
While True means it will keep asking for user input unless there is some condition that helps break out of loop ,so when does it do that? so in the last elif statement add break if the user enters less than 1600 while loop won't ask for further inputs or you can add break however you want it to be Also in sololearn you need to give all inputs at once.
23rd May 2020, 10:58 AM
Abhay
Abhay - avatar
+ 4
sololearn doesnt take input like a normal terminal would do, you have to provide ALL the inputs in the starting prompt itself. The code is fine and it should run well on a normal terminal. I guess you are providing a single input to check if the ValueError except block. So after the first input returns a ValueError, it looks for a second input but it cant find any and returns an EOFError
23rd May 2020, 11:03 AM
Prabhakar Dev
Prabhakar Dev - avatar
+ 3
Bunyod Abdusaidov the prompt wouldn't have your input string, it will only get displayed on your console. And you can see the input string on the console after running it.
23rd May 2020, 11:54 AM
Prabhakar Dev
Prabhakar Dev - avatar
+ 2
Bunyod Abdusaidov did you mean the year isnt displayed in the console? i cant understand what you said
23rd May 2020, 11:13 AM
Prabhakar Dev
Prabhakar Dev - avatar
0
Thanks, it somehow didn't give an error. But, why my custom input which asks the user to enter a year is not displayed when I run the code? What should I do?
23rd May 2020, 11:07 AM
Bunyod Abdusaidov
Bunyod Abdusaidov - avatar
0
No, not year. The code should asks the user the year which the user wants to know the century of. It should display an input asking "Enter a year", but it doesn't!?
23rd May 2020, 11:46 AM
Bunyod Abdusaidov
Bunyod Abdusaidov - avatar