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.
It is not surprising that you are able to sometimes pass and sometimes fail with the same code, because most Codewars kata include random tests that are re-generated every time you try to submit your code. So it can happen that you are "lucky" in some submissions and "unlucky" in other.
For your buggy solution specifically (although you do not provide it so I cannot see it), it could mean that the Python submission tests are too weak and should be hardened. However, it is not always easy to predict all mistakes people could make, as it is possible to solve the same task with many different algorithms and some solutions have subtle bugs that only happen for rare values.
The issue wasn't just the incorrect sum (which I was aware of), but rather the inconsistent behavior of the assert engine. Despite making no changes to the test values or code, tests would randomly pass or fail. In some instances, even with the correct string, it would throw an error. Paradoxically, the same code with the correct sum would fail, yet running it again without modifications would suddenly pass. It was baffling.
To resolve this, I reset the code completely, reimplemented the correct solution, and it finally worked consistently.
This appears to be a platform bug. If you encounter tests arbitrarily passing or failing without code changes, remember that resetting the problem is likely your solution
nitpick: minor typo in the description
indivi[DU]al
your algo is wrong
please re-read the description
This comment is hidden because it contains spoiler information about the solution
Java translation
Please use appropriate markdown formatting and flag your comment as a spoiler when posting code. See https://docs.codewars.com/training/troubleshooting#post-discourse.
Your final if statement is fine, but you're calculating the sums incorrectly.
This comment is hidden because it contains spoiler information about the solution
No random tests in Dart
No random tests in Dart
No random tests in C#
nice kata!
Forked & approved
Passing the test but can't pass when I submit?
Loading more items...