+ 6
What is wrong with this?
I was creating a simple Python quiz game that asks the user a series of questions. The user earns points for each correct answer, and at the end, their score is displayed as a percentage. It works in my IDE but raises an error on the SoloLearn playground.
16 odpowiedzi
+ 10
it's the way sololearn taking your inputs. You must add all inputs at the beginning and when you take the 1st input it gets everything the yes and the extension and comparing with yes so will stop. If type only yes then if proceed the execution but you not typed any extension so it try to read from the input and there is nothing new there so it throw an exception that you have to catch and handle it properly.
In conclusion, your code is ok but it cannot run on sololearn
+ 5
Nusaybah 🇵🇸 you might try doing something like this which will allow individual input / prompts if you are trying to do this on sololearn as stated by others.
https://sololearn.com/compiler-playground/WNe84Xy61Lpj/?ref=app
+ 5
Nusaybah 🇵🇸
sorry for my late reply, i was a bit short of time.
the error message you mentioned indicates that the number of input values (each in a separate line in the popup window) is not matching with the number of input() functions used.
the message appears when the number of input values is *less* than the number of input() function calls.
the reason behind this is the way that sololearn playground is using to get user input and pass them to the server to execute the code.
all inputs in playground has to be given in advance.
so the code itself is working properly if the special requirements are followed.
+ 4
Nusaybah 🇵🇸 ,
`...raising an error...` needs a bit more details. what is the error message?
+ 4
1.The final output string has a typo where a space is missing before "correct".
2.Uppercase in answer comparison: Some answer comparisons do not convert both parts to lowercase, which can cause correct answers to be marked as incorrect.
+ 4
Nusaybah 🇵🇸 ,
may i ask this very simple question again: ***what is the error message that is raised?***
+ 3
Maybe try making sure that where you put "if answer.lower == whatever" the thing that it's checking that it is is all lowercase. Remember: Python is a case-sensitive language.
+ 3
It seems like there might be compatibility issues between your Python code and the SoloLearn playground environment. Sometimes, certain features or libraries that work in one environment might not be supported in another. Check if you're using any libraries or features that might not be supported by the SoloLearn platform. Additionally, ensure that your code follows Python's syntax guidelines and doesn't rely on any IDE-specific functionality.
+ 3
Lothar it said
EOFError : EOF when reading the line ,
+ 3
BroFar thank u so much
+ 1
+ 1
john ds thanks, I concure with ur assessments
+ 1
STE4LPH 🫡Thanks
+ 1
It is on line 11
+ 1
Lothar got it thanks.