Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This test case expectation is for array above the printed text (not below). The one you showed expects 'NO'.
Also, if you open a new thread, please continue there, don't create new ones for no good reason.
Please see if this helps: https://docs.codewars.com/training/troubleshooting/#print-input
the error message is most probably caused by the fact that OP's solution has a side effect (it mutates global variables), and is called twice. First call returns a correct result, but its used only to build an assertion message. the next call uses mutated state and returns invalid result, assertion fails, and the message composed in the previous step (i.e. the one with the correct answer) is displayed.
Test suite is wrong because it calls user solution twice. Solution is wrong because it uses global variables.
Well, I'm not sure how you got that error message, because for me your code produces other problems, like
because of the syntax issue of apparently intending to show multiplication of
first_num * n
instead. This also happens at2i
which should be2 * i
. Finally, you also have variables declared outside the function that should be inside the function. That might be it, just don't forget the include theinttypes
header.Please see here on how to post code in kata discourse: https://docs.codewars.com/references/markdown/#code-block
Hi @RJ20192, can you please post your code with proper markdown and a spoiler tag? I have a guess as to why your code might fail but I'd like to see why you're getting that error message, thanks.
Which language?
This comment is hidden because it contains spoiler information about the solution
The last bullet point of this paragraph could be helpful: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution#when-i-print-my-answer-it-looks-exactly-the-same-as-the-expected-output-yet-tests-fail