Every time it's saying that the answer is wrong! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Every time it's saying that the answer is wrong!

Run the code, (wait) click “Start game” btn, now try writing the correct atomic number of the given element. Whatever you write, either correct or wrong, it says that the answer is Wrong. Why? https://code.sololearn.com/WlF1pR0Y75gd/?ref=app

24th Dec 2021, 2:55 AM
Parth
Parth - avatar
2 Answers
+ 4
You set variables elementCount, randInt and elementNameInH1 in multiple places, apparently with the same objective. Why? Some of them are set only in functions, others both in functions and globally. Why? Running the code, I saw that it always wants the first value assigned to the global instance of randInt. Organize your variables. Think about their scope, and also which ones should be set every loop. BTW, the input field message is truncated - the user doesn't know what the program wants.
24th Dec 2021, 3:18 AM
Emerson Prado
Emerson Prado - avatar
+ 1
Emerson Prado now see it. I have edited the input field.
24th Dec 2021, 1:19 PM
Parth
Parth - avatar