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.
You can't use the word
group
, even in comments.It returns
False
in those cases, just like the description says to.This is not an issue with the kata, this is an issue with your code. The input that you're failing on is not
123
, look more closely.Yes, if you notice, all the punctuation in the tests is currently separated by spaces. Even in the description, the example shows the punctuation separated by a space. This is likely intentional to make the kata simpler. The solutions were all built with this in mind, so of course they won't work properly if you change the nature of the inputs. Adding tests as you've suggested would invalidate the vast majority of the 165k+ solutions, and isn't really worth doing.
It crashes on the third sample test where the input is an empty string.
No, your code just doesn't work. Look at the word
aren't
This comment is hidden because it contains spoiler information about the solution
That method is not available in numpy version 1.24, which is the version that codewars currently uses. You could request a module update on github, but that will likely take a long time. Realistically, you just need to find another way to solve the kata. Your solution can work with minimal changes if you examine the documentation that you linked more closely.
Yes, the reference solution for java incorrectly checks for exactly 2 sets of 2 cubes that add up to
n
instead of at least 2 sets of 2 cubes.Why would you treat double spaces any differently than single spaces? I don't think this is reason enough to raise an issue.
dani is correct, you need to be able to express the number as two different sets of two cubes in order to return true.
The description says to check if the number can be written as the sum of two cubes in two different ways, there's nothing to suggest that it can only be written in two ways.
This comment is hidden because it contains spoiler information about the solution
It's your solution. Your solution fails on inputs where encoded text could also be a binary number, and you can see it in the output of the test that you included.
Expected: 'wrqjvi, 0, dubb, 13, j...
Your solution produced:instead got: 'wrqjvi, 0, dubb, 13, 6...
, notice that you have two numbers in a row? Becausej
is110
, which can also be interpreted as a binary number. Your solution will fail on similar tests, you can add this to the sample tests:Test.assertEquals(decode('1011011011019800110110'), "aaa, 54");
to see it failing in real time.You just got lucky when you resubmitted your solution and the tests didn't generate a case like this one. The random tests might need to be hardened to make sure to include a "tricky" case like this, but as it is, there is nothing going "wrong" with the tests.
You can print the list of installed modules by switching the python version to one before 3.11 and calling
help('modules')
inside of a kataLoading more items...