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.
Thanks, got it :)
It's your code's job to handle that case too.
In Python, one of the test cases try to call the function without an argument and fail.
My pleasure. Hope you will populate soon Codewars with new Rust katas, they are missing!
Thanks. This was my first one. I really appreciate your help.
Approved :)
(next time you propose a translation for reviewal, you'd better put a suggestion flag to give it more visibility)
Done. And I made it 50. :)
You could also reduce the number of tests, though it doesn't matter that much (30 sets of tests would be enough)
Nice. Sorry to bother you again, but it's good to have robust tests, I've just realized a solution that would control erroneously the result rounding down
n
can sometimes pass the tests. I suggest to add another line like this:This way it will be the most robust tests of all languages, and no rounding or truncating method will pass ;) As you can see on the Discourse page, Voile already raised an issue about weak tests in some languages. It's better to have robust tests in new translations :)
https://www.codewars.com/kumite/617663830a9ae1001aa15dea?sel=626ab7b4bae2950059360028
Here's the fork. Thanks for your help. The gen_range() function changes how it takes the numbers between versions.
I get
Language version is invalid
if I try to approve. You need to update the version (fork this translation and select version 1.60, and control everything works fine).I added that test, as well.
Yes but the idea is to test it also randomly in random tests. There is no point in having random tests if they all expect the same. You can refer to other languages to see how they do it.
Isn't 1.0 already tested in the regular cases?
Ok, tests now work, but random tests have a low probability to generate
1.0
, so just returntrue
passes most them of times. This is not big issue (this kata is really basic), but you should study to design random tests to be sure they always generate a certain amount of1.0
.You can refer to other languages. For example you could replace line 18 with:
(there are other possibilities)
Loading more items...