+ 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.

11th Jun 2024, 6:01 PM
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ - avatar
16 Answers
+ 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
11th Jun 2024, 9:18 PM
john ds
john ds - avatar
+ 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
13th Jun 2024, 3:36 AM
BroFar
BroFar - avatar
+ 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.
14th Jun 2024, 5:45 PM
Lothar
Lothar - avatar
+ 4
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ , `...raising an error...` needs a bit more details. what is the error message?
11th Jun 2024, 6:22 PM
Lothar
Lothar - avatar
+ 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.
12th Jun 2024, 12:09 AM
STE4LPH
STE4LPH - avatar
+ 4
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ , may i ask this very simple question again: ***what is the error message that is raised?***
12th Jun 2024, 3:51 PM
Lothar
Lothar - avatar
+ 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.
11th Jun 2024, 6:59 PM
Jonathan Dodge
Jonathan Dodge - avatar
+ 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.
12th Jun 2024, 2:13 PM
Vivienne Medrano
+ 3
Lothar it said EOFError : EOF when reading the line ,
12th Jun 2024, 7:52 PM
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ - avatar
+ 3
BroFar thank u so much
13th Jun 2024, 8:45 AM
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ - avatar
11th Jun 2024, 6:33 PM
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ - avatar
11th Jun 2024, 6:33 PM
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ - avatar
+ 1
john ds thanks, I concure with ur assessments
12th Jun 2024, 9:35 AM
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ - avatar
+ 1
STE4LPH ๐ŸซกThanks
12th Jun 2024, 9:36 AM
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ - avatar
+ 1
It is on line 11
12th Jun 2024, 7:53 PM
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ - avatar
+ 1
Lothar got it thanks.
15th Jun 2024, 7:28 PM
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ
Nusaybah ๐Ÿ‡ต๐Ÿ‡ธ - avatar