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.
Instead of saying
- 1 * (expression)
, you could say- (expression)
, as boolean values are interpreted as 1 or 0 in arithmetic, and you can subtract those as well like you can do with (almost) any value.I agree. I think most people (including myself) approached the problem as if a number in the array had to be divisible by its index, but this doesn't work correctly for index zero as we cannot divide by zero. However, as you suggested, zero is a multiple of every number, including itself. I agree that if zero appears at the zeroth index it is a valid multiple and should probably be included.
This comment is hidden because it contains spoiler information about the solution
Try printing the input. Then you can see what inputs cause your code to fail and debug it from there.
It means you have given a word that the kata writer does not consider to be in the input. The most likely explanation is that you have split a word where the writer did not want you to (e.g. splitting "wor'd" into "wor" and "d") or you have joined two or more words that the kata writer considered to be separate. Try printing the input immediately and you should get a better idea what the random tests are like. Only apostrophes can be used to connect letters together into one word.
There is currently an example of this in python: one of the test cases has 'CodeWars is nice' as the input with the expected result '#CodewarsIsNice'. When this test is failed the message 'Should capitalize all letters of words - all lower case but the first.' is given.
Tax is a rate you must pay as a percentage of your earnings. Your invested savings themselves are not included in the tax calculation, only the earnings made from the interest. If, in a given year, you earn $100, a tax rate of 20% (0.2) would mean $20 must be paid as tax. Your invested savings would increase by $80 that year.
For anybody still wondering what behaviour the kata requires for apostrophes or hyphenation: hyphenated words should be broken up into two separate words (e.g. "three-quarters" becomes "three quarters").
Apostrophes are treated as letters iff they are beside actual letters, or other apostrophes that are. Apostrophes alone do not form a word.
''h'el''lo is a considered word, while ''' is not
yeah, this frustrated me for a bit because the solution I wrote seemed to work fine in the console but would not work in codewars. I guess I should have paid more attention and ran the equations as they were written with the extra space!
JavaScript as well
I noticed a small potential issue in the python random tests. Inputs are given with a space " " as the final character in the string, which I would not have expected based on the description, examples or fixed tests.
I think there is still a bug that means it fails a small number of cases. I suspect there are very specific circumstances where a bug in the code breaks the method. While trying to understand what these circumstances were, a test ran without any examples of the cases that break the method and I accidentally submitted. This is also why my debugging print statements are also present.
Closing then.
I think it is clearer now. Thanks.
Is it ok now?
Loading more items...