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.
duplicate issue above
I used the SUM method wondering if the tests would be vague enough to fall of it. It did... this test could easily be added to catch my sneaky solution.
I also have this message,but I solved it by removing my
console.log
statement.I see some wrong answers (checking only for SUMS), I guess the tests doesn't cover an example with duplicates but the same sum?
I think -1 existed long before Java. And it's bad but it's consistent with the behavior of
indexOf
in JS. And falsy values in a language with falsy 0 aren't much better in this case (used in PHP for this kind of functions; using==
instead of===
results in a bug)...I would replace the -1 result with a null/undefined/false, -1 index it's a Java relic limitation that should not exists in the first place. It is more confusing in JS because you can do string.slice(-1).
Nice one really, all the basic algorithms should have at least 1 kata around here.
This comment is hidden because it contains spoiler information about the solution
I did. Done, thanks.
Why would you pass a String of numbers in the first place?
Do you mean DIGITS not numbers, please update the description because the results are very different.
This website is in English only at the moment (I don't see any buttons to change the language, at least), so it makes sense that a kata would be English focused if it isn't specifically targeting some other language.
Also, English's silly ordinal number system makes the kata more challenging. Returning
century + "世紀"
is considerably easier than what you currently have to do.I'd be happy to.
The text you see there is written as a [comment](https://en.wikipedia.org/wiki/Comment_(computer_programming) so it just informs you and doesn't do anything. In software development there is a methodology named "Agile" which focuses on TDD (test driven development) - it's basically custom written testcases suited to the current project. The "Run Examples" section follows this concept so that the user can write their own custom testcases if they so choose so (it's optional). When creating a Kata the author has the option to either put the "Examples" full of examples testcases, or they can leave it blank and the TDD box will appear for custom written testcases.
The testing framework on Codewars is custom and so these functions are premade & preloaded already for you. They are used for creating/authoring your own Kata and each function has a different purpose - see here for information.
blah blah blah look at the link before for more info
Example
tl;dr it's for user custom tests
Indeed! Thank you very much for your answer!!!
What is happening exactly when you launch the tests through "Run Examples" or "Attempt"? I mean behind the button... How these "sections" are organized? The following text is written in the exercise but I don't really get it. Could you explain a bit?
TODO: Replace examples and use TDD development by writing your own tests
These are some of the methods available:
test.expect(boolean, [optional] message)
test.assert_equals(actual, expected, [optional] message)
test.assert_not_equals(actual, expected, [optional] message)
You can use Test.describe and Test.it to write BDD style test groupings
I'm assuming you're clicking the "Run Examples" tab which is just a section for example test cases. Click "Attempt" to go through the actual testcases which allow you to pass and submit your solution.
If I write:
def whatCentury(year):
return True (=> with the indentation of course)
Or even:
def whatCentury(year):
print(year) (=> with the indentation of course)
In Python 3.4 the output is "error" without explanation... Do you know why?
Loading more items...