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.
No problem - I'm sorry that you don't get to earn points for this kata, I hope you liked working on it though!
I understand now, thanks and sorry
Thanks for attempting this again, but I unpublished it as the mods found it was a duplicate of another kata.
Still, just to help you out - your code is still wrong you are reading the error messages incorrectly.
When you see, in Console output:
Returned solution list is not valid for input value of n = 11
that message is applying to the input ABOVE it, not below.
When you run your code, you can see then a part which says:
Log
12
[3,4,5]
Test Passed
That means your code DOES work for the input
n = 12
, and is returning[3,4,5]
which is a correct answer.As I mentioned earlier, your code is failing for the input
n = 11
still; you can see this in your IDE - when you run the code with inputn = 11
it returns an empty list when there is in fact a valid solution which your code is not finding.print(n) # 12
print(result) # [3, 4, 5]
Returned solution list is not valid for input value of n = 11
resolved as I will unpublish and translate older JS duplicate instead
Hi @Blind4Basics - thanks for the swift reply. It's noted then, I will unpublish this now.
As it will be my first attempt at translation, I will read the docs a bit so I make sure I do a good job. I noted your comments about keeping consistent difficulty also.
Thanks,
the best course of action would be to unpublish yours and translate the other (possibly improving its tests if it doesn't have random tests yet). But keep in mind the difficulty must be consistent with other languages (meaning: not changing the time complexity of the expected solution, if you add brand new random tests)
problem is: I bet there are already a lot of optimal solutions in the other kata, so I don't think it's a good idea
Hi @hobovsky - thanks for the suggestion; that's actually pretty elegant - I'll see what @Voile thinks about deleting this if it's considered a duplicate of the JavaScript one, if it survives I'll rewrite to use your suggested output format.
Thanks,
Hi @Voile - sorry, as I replied to @hobovsky below:
I of course searched for duplicates before publishing, but didn't see the kata you linked: In my defense, probably because the title Find the integer sequences is kinda vague and doesn't contain any relevant keywords ("express" "write" "consecutive" etc.)
Also maybe because it isn't translated into any of my languages (only JS/Haskell)?
How do you want me to proceed: I can keep this as the only Python version of the same problem, with higher test requirements, or do you want me to delete it and maybe use it as a translation for that one?
Ah nope, that's an error with your code I'm afraid - I copied your solution and tested it; with the input value of
n = 11
your code is returning an empty list when there is in fact a valid solution[5,6]
Hey @hobovsky - I found the second one while seaching for duplicates and it's the much simpler version of this; just asks for True/False for given n without the actual formatting.
The first one I didn't find while searching; and it didn't get auto-suggested, presumably because it doesn't include "consecutive" (or anything useful for searching it really) in title.
Also maybe because it's not available in any of my languages (only JS and Haskell).
I'll unpublish based on your comment and Voile's issue above - maybe will use as translation for JS/Haskell kata I guess.
This is indeed a duplicate of https://www.codewars.com/kata/582aad136755daf91a000021: I passed the tests using my JS solution of that kata.
There is an error in one of the python tests:
expected result is 11, when n is actually 12
Your s(n) def works wrong. For example try 4 or 16
You should add something like "if (i*i == n): S += i"